libmongocrypt-helper 1.13.2.0.1001 → 1.14.0.0.1001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +8 -0
- data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +5 -1
- data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +4 -1
- data/ext/libmongocrypt/libmongocrypt/Earthfile +18 -17
- data/ext/libmongocrypt/libmongocrypt/README.md +8 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +7 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CONTRIBUTING.md +34 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +6 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +18 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +9 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +14 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +6 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +8 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/libmongocrypt-version.txt +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/{release.sh → scripts/release.sh} +9 -3
- data/ext/libmongocrypt/libmongocrypt/bindings/python/{synchro.py → scripts/synchro.py} +16 -9
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/synchro.sh +8 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update-version.sh +27 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update_binding.py +78 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +15 -0
- data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +25 -18
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +39 -13
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +1 -1
- data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +2 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.c +5 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/hexlify.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_azure_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +1 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message_private.h +5 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_opt.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -8
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.h +9 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_response_parser.c +0 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.c +7 -3
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/sort.h +2 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +8 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_assert.h +5 -4
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_azure_online.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_gcp_online.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_request.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response.c +3 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_kmip_response_parser.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_online_util.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_request.c +39 -39
- data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +235 -65
- data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +4 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +1 -4
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +9 -11
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +1 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +10 -8
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +167 -176
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +6 -17
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +6 -17
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +25 -26
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +2 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload-private.h +122 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload.c +477 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +1 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +28 -43
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +6 -17
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +6 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +13 -10
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +7 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block.c +4 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils-private.h +27 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-parse-utils.c +48 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +5 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +15 -20
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +4 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +9 -18
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +4 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +5 -9
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +14 -19
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +2 -4
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +109 -119
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker-private.h +0 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker.c +4 -14
- data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets.c +3 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode-private.h +8 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode.c +78 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +34 -16
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +66 -74
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +12 -1
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +5 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +2 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +65 -58
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +3 -3
- data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +4 -4
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +29 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +6 -3
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +48 -58
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +12 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +5 -13
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +19 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +9 -9
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +3 -4
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +285 -89
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +0 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +0 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +4 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +47 -31
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +2 -0
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +3 -1
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/unicode/case-fold-map.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/unicode/diacritic-fold-map.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +0 -14
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +6 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +14 -6
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +14 -6
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +3 -3
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +11 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +9 -11
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-encryption-placeholder.c +18 -29
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +2 -18
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-text-payload.c +320 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +2 -17
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +8 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +6 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +29 -33
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +12 -20
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +5 -20
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-text-search-str-encode.c +147 -18
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +35 -14
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +10 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +3 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +36 -24
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +13 -13
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +49 -55
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +64 -67
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +18 -18
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +4 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +13 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +31 -13
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +35 -52
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +28 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +50 -91
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +7 -4
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +3 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +527 -225
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +45 -56
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +12 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +11 -11
- data/ext/libmongocrypt/libmongocrypt/test/test-unicode-fold.c +6 -2
- data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/util.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/util/util.h +7 -6
- data/lib/libmongocrypt_helper/version.rb +2 -2
- metadata +17 -13
- data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +0 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +0 -50
- data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +0 -14
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +0 -29
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +0 -29
- data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EqualityIndexedValueV2.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2RangeIndexedValueV2.json +0 -8
- /data/ext/libmongocrypt/libmongocrypt/bindings/python/{build-manylinux-wheel.sh → scripts/build-manylinux-wheel.sh} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/{FLE2InsertUpdatePayload-with-edges.json → FLE2InsertUpdatePayload-RangeV1.json} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/{FLE2InsertUpdatePayload-with-edges-V2.json → FLE2InsertUpdatePayloadV2-RangeV1.json} +0 -0
@@ -81,10 +81,13 @@ void _usleep(int64_t usec) {
|
|
81
81
|
}
|
82
82
|
|
83
83
|
#define TEST_DATA_COUNT_INC(var) \
|
84
|
-
(
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
if (1) { \
|
85
|
+
(var)++; \
|
86
|
+
if ((var) >= TEST_DATA_COUNT) { \
|
87
|
+
TEST_ERROR("TEST_DATA_COUNT exceeded for %s. Increment TEST_DATA_COUNT.", #var); \
|
88
|
+
} \
|
89
|
+
} else \
|
90
|
+
((void)0)
|
88
91
|
|
89
92
|
static void _load_json(_mongocrypt_tester_t *tester, const char *path) {
|
90
93
|
bson_t as_bson;
|
@@ -206,26 +209,20 @@ bson_t *_mongocrypt_tester_file_as_bson(_mongocrypt_tester_t *tester, const char
|
|
206
209
|
return bson;
|
207
210
|
}
|
208
211
|
|
209
|
-
bson_t *
|
210
|
-
|
211
|
-
char *full_json;
|
212
|
-
bson_t *bson;
|
213
|
-
bson_error_t error;
|
214
|
-
char *c;
|
212
|
+
bson_t *_mongocrypt_tester_bson_from_str(_mongocrypt_tester_t *tester, const char *json) {
|
213
|
+
char *const full_json = bson_strdup(json);
|
215
214
|
|
216
|
-
va_start(ap, json);
|
217
|
-
full_json = bson_strdupv_printf(json, ap);
|
218
215
|
/* Replace ' with " */
|
219
|
-
for (c = full_json; *c; c++) {
|
216
|
+
for (char *c = full_json; *c; c++) {
|
220
217
|
if (*c == '\'') {
|
221
218
|
*c = '"';
|
222
219
|
}
|
223
220
|
}
|
224
221
|
|
225
|
-
|
226
|
-
bson = &tester->test_bson[tester->bson_count];
|
222
|
+
bson_error_t error;
|
223
|
+
bson_t *const bson = &tester->test_bson[tester->bson_count];
|
227
224
|
TEST_DATA_COUNT_INC(tester->bson_count);
|
228
|
-
if (!bson_init_from_json(bson, full_json,
|
225
|
+
if (!bson_init_from_json(bson, full_json, -1, &error)) {
|
229
226
|
TEST_STDERR_PRINTF("%s", error.message);
|
230
227
|
abort();
|
231
228
|
}
|
@@ -233,6 +230,17 @@ bson_t *_mongocrypt_tester_bson_from_json(_mongocrypt_tester_t *tester, const ch
|
|
233
230
|
return bson;
|
234
231
|
}
|
235
232
|
|
233
|
+
bson_t *_mongocrypt_tester_bson_from_json(_mongocrypt_tester_t *tester, const char *json, ...) {
|
234
|
+
va_list ap;
|
235
|
+
va_start(ap, json);
|
236
|
+
char *const full_json = bson_strdupv_printf(json, ap);
|
237
|
+
va_end(ap);
|
238
|
+
|
239
|
+
bson_t *const bson = _mongocrypt_tester_bson_from_str(tester, full_json);
|
240
|
+
bson_free(full_json);
|
241
|
+
return bson;
|
242
|
+
}
|
243
|
+
|
236
244
|
bson_t *tmp_bsonf(_mongocrypt_tester_t *tester, const char *fmt, ...) {
|
237
245
|
va_list arg;
|
238
246
|
va_start(arg, fmt);
|
@@ -283,41 +291,30 @@ bson_t *tmp_bsonf(_mongocrypt_tester_t *tester, const char *fmt, ...) {
|
|
283
291
|
#undef ENSURE_CAPACITY
|
284
292
|
|
285
293
|
dst[dst_len] = '\0';
|
286
|
-
bson_t *tmp =
|
294
|
+
bson_t *tmp = TMP_BSON_STR(dst);
|
287
295
|
va_end(arg);
|
288
296
|
bson_free(dst);
|
289
297
|
return tmp;
|
290
298
|
}
|
291
299
|
|
292
|
-
mongocrypt_binary_t *
|
293
|
-
|
294
|
-
char *full_json;
|
295
|
-
bson_t *bson;
|
296
|
-
mongocrypt_binary_t *bin;
|
297
|
-
bson_error_t error;
|
298
|
-
char *c;
|
299
|
-
|
300
|
-
va_start(ap, json);
|
301
|
-
full_json = bson_strdupv_printf(json, ap);
|
302
|
-
/* Replace ' with " */
|
303
|
-
for (c = full_json; *c; c++) {
|
304
|
-
if (*c == '\'') {
|
305
|
-
*c = '"';
|
306
|
-
}
|
307
|
-
}
|
308
|
-
|
309
|
-
va_end(ap);
|
310
|
-
bson = &tester->test_bson[tester->bson_count];
|
311
|
-
TEST_DATA_COUNT_INC(tester->bson_count);
|
312
|
-
if (!bson_init_from_json(bson, full_json, strlen(full_json), &error)) {
|
313
|
-
TEST_STDERR_PRINTF("failed to parse JSON %s: %s", error.message, json);
|
314
|
-
abort();
|
315
|
-
}
|
316
|
-
bin = mongocrypt_binary_new();
|
300
|
+
mongocrypt_binary_t *_mongocrypt_tester_bin_from_str(_mongocrypt_tester_t *tester, const char *json) {
|
301
|
+
mongocrypt_binary_t *const bin = mongocrypt_binary_new();
|
317
302
|
tester->test_bin[tester->bin_count] = bin;
|
318
303
|
TEST_DATA_COUNT_INC(tester->bin_count);
|
304
|
+
|
305
|
+
bson_t *const bson = _mongocrypt_tester_bson_from_str(tester, json);
|
319
306
|
bin->data = (uint8_t *)bson_get_data(bson);
|
320
307
|
bin->len = bson->len;
|
308
|
+
return bin;
|
309
|
+
}
|
310
|
+
|
311
|
+
mongocrypt_binary_t *_mongocrypt_tester_bin_from_json(_mongocrypt_tester_t *tester, const char *json, ...) {
|
312
|
+
va_list ap;
|
313
|
+
va_start(ap, json);
|
314
|
+
char *const full_json = bson_strdupv_printf(json, ap);
|
315
|
+
va_end(ap);
|
316
|
+
|
317
|
+
mongocrypt_binary_t *const bin = _mongocrypt_tester_bin_from_str(tester, full_json);
|
321
318
|
bson_free(full_json);
|
322
319
|
return bin;
|
323
320
|
}
|
@@ -459,8 +456,8 @@ const char *_mongocrypt_tester_plaintext(_mongocrypt_tester_t *tester) {
|
|
459
456
|
status = mongocrypt_status_new();
|
460
457
|
ASSERT_OR_PRINT(_mongocrypt_marking_parse_unowned(&buf, &marking, status), status);
|
461
458
|
mongocrypt_status_destroy(status);
|
462
|
-
BSON_ASSERT(BSON_ITER_HOLDS_UTF8(&marking.v_iter));
|
463
|
-
return bson_iter_utf8(&marking.v_iter, NULL);
|
459
|
+
BSON_ASSERT(BSON_ITER_HOLDS_UTF8(&marking.u.fle1.v_iter));
|
460
|
+
return bson_iter_utf8(&marking.u.fle1.v_iter, NULL);
|
464
461
|
}
|
465
462
|
|
466
463
|
mongocrypt_binary_t *_mongocrypt_tester_encrypted_doc(_mongocrypt_tester_t *tester) {
|
@@ -575,11 +572,6 @@ mongocrypt_t *_mongocrypt_tester_mongocrypt(tester_mongocrypt_flags flags) {
|
|
575
572
|
if (flags & TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB) {
|
576
573
|
mongocrypt_setopt_append_crypt_shared_lib_search_path(crypt, "$ORIGIN");
|
577
574
|
}
|
578
|
-
if (flags & TESTER_MONGOCRYPT_WITH_RANGE_V2) {
|
579
|
-
ASSERT(mongocrypt_setopt_use_range_v2(crypt));
|
580
|
-
} else {
|
581
|
-
crypt->opts.use_range_v2 = false;
|
582
|
-
}
|
583
575
|
if (flags & TESTER_MONGOCRYPT_WITH_SHORT_CACHE) {
|
584
576
|
ASSERT(mongocrypt_setopt_key_expiration(crypt, 1));
|
585
577
|
}
|
@@ -599,10 +591,6 @@ mongocrypt_t *_mongocrypt_tester_mongocrypt(tester_mongocrypt_flags flags) {
|
|
599
591
|
|
600
592
|
bool _mongocrypt_init_for_test(mongocrypt_t *crypt) {
|
601
593
|
BSON_ASSERT_PARAM(crypt);
|
602
|
-
// Even if the ENABLE_USE_RANGE_V2 compile flag is on, we should have range V2 off by default for testing, as many
|
603
|
-
// existing tests are based around range V2 being disabled. To use range V2, use the TESTER_MONGOCRYPT_WITH_RANGE_V2
|
604
|
-
// flag with the above function.
|
605
|
-
crypt->opts.use_range_v2 = false;
|
606
594
|
return mongocrypt_init(crypt);
|
607
595
|
}
|
608
596
|
|
@@ -876,14 +864,14 @@ static void _test_setopt_kms_providers(_mongocrypt_tester_t *tester) {
|
|
876
864
|
mongocrypt_setopt_use_need_kms_credentials_state(crypt);
|
877
865
|
}
|
878
866
|
if (!test->errmsg) {
|
879
|
-
ASSERT_OK(mongocrypt_setopt_kms_providers(crypt,
|
867
|
+
ASSERT_OK(mongocrypt_setopt_kms_providers(crypt, TEST_BSON_STR(test->value)), crypt);
|
880
868
|
if (!test->errmsg_init) {
|
881
869
|
ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
|
882
870
|
} else {
|
883
871
|
ASSERT_FAILS(_mongocrypt_init_for_test(crypt), crypt, test->errmsg_init);
|
884
872
|
}
|
885
873
|
} else {
|
886
|
-
ASSERT_FAILS(mongocrypt_setopt_kms_providers(crypt,
|
874
|
+
ASSERT_FAILS(mongocrypt_setopt_kms_providers(crypt, TEST_BSON_STR(test->value)), crypt, test->errmsg);
|
887
875
|
}
|
888
876
|
mongocrypt_destroy(crypt);
|
889
877
|
}
|
@@ -930,7 +918,7 @@ static void test_tmp_bsonf(_mongocrypt_tester_t *tester) {
|
|
930
918
|
bool _aes_ctr_is_supported_by_os = true;
|
931
919
|
|
932
920
|
int main(int argc, char **argv) {
|
933
|
-
_mongocrypt_tester_t tester = {0};
|
921
|
+
static _mongocrypt_tester_t tester = {0};
|
934
922
|
int i;
|
935
923
|
|
936
924
|
TEST_PRINTF("Pass a list of patterns to run a subset of tests.\n");
|
@@ -989,6 +977,7 @@ int main(int argc, char **argv) {
|
|
989
977
|
_mongocrypt_tester_install_fle2_payload_iup_v2(&tester);
|
990
978
|
_mongocrypt_tester_install_fle2_payload_find_equality_v2(&tester);
|
991
979
|
_mongocrypt_tester_install_fle2_payload_find_range_v2(&tester);
|
980
|
+
_mongocrypt_tester_install_fle2_payload_find_text(&tester);
|
992
981
|
_mongocrypt_tester_install_fle2_tag_and_encrypted_metadata_block(&tester);
|
993
982
|
_mongocrypt_tester_install_range_encoding(&tester);
|
994
983
|
_mongocrypt_tester_install_range_edge_generation(&tester);
|
@@ -40,8 +40,6 @@ typedef enum tester_mongocrypt_flags {
|
|
40
40
|
/// crypt_shared library must be present in the same directory as the test
|
41
41
|
/// executable.
|
42
42
|
TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB = 1 << 0,
|
43
|
-
/// Enable range V2
|
44
|
-
TESTER_MONGOCRYPT_WITH_RANGE_V2 = 1 << 2,
|
45
43
|
/// Short cache expiration
|
46
44
|
TESTER_MONGOCRYPT_WITH_SHORT_CACHE = 1 << 3,
|
47
45
|
/// Do not call `mongocrypt_init` yet to allow for further configuration of the resulting `mongocrypt_t`.
|
@@ -49,7 +47,6 @@ typedef enum tester_mongocrypt_flags {
|
|
49
47
|
} tester_mongocrypt_flags;
|
50
48
|
|
51
49
|
/* Arbitrary max of 2148 instances of temporary test data. Increase as needed.
|
52
|
-
* TODO(MONGOCRYPT-775) increasing further (e.g. 3000+) causes a segfault on Windows test runs. Revise.
|
53
50
|
*/
|
54
51
|
#define TEST_DATA_COUNT 2148
|
55
52
|
|
@@ -195,6 +192,8 @@ void _mongocrypt_tester_install_fle2_payload_find_equality_v2(_mongocrypt_tester
|
|
195
192
|
|
196
193
|
void _mongocrypt_tester_install_fle2_payload_find_range_v2(_mongocrypt_tester_t *tester);
|
197
194
|
|
195
|
+
void _mongocrypt_tester_install_fle2_payload_find_text(_mongocrypt_tester_t *tester);
|
196
|
+
|
198
197
|
void _mongocrypt_tester_install_fle2_tag_and_encrypted_metadata_block(_mongocrypt_tester_t *tester);
|
199
198
|
|
200
199
|
void _mongocrypt_tester_install_gcp_auth(_mongocrypt_tester_t *tester);
|
@@ -228,6 +227,11 @@ void _mongocrypt_tester_install_mc_schema_broker(_mongocrypt_tester_t *tester);
|
|
228
227
|
/* Conveniences for getting test data. */
|
229
228
|
|
230
229
|
/* Get a temporary bson_t from a JSON string. Do not free it. */
|
230
|
+
bson_t *_mongocrypt_tester_bson_from_str(_mongocrypt_tester_t *tester, const char *json);
|
231
|
+
#define TMP_BSON_STR(...) _mongocrypt_tester_bson_from_str(tester, __VA_ARGS__)
|
232
|
+
|
233
|
+
/* Get a temporary bson_t from a formattable JSON string. Do not free it. */
|
234
|
+
MLIB_ANNOTATE_PRINTF(2, 3)
|
231
235
|
bson_t *_mongocrypt_tester_bson_from_json(_mongocrypt_tester_t *tester, const char *json, ...);
|
232
236
|
#define TMP_BSON(...) _mongocrypt_tester_bson_from_json(tester, __VA_ARGS__)
|
233
237
|
|
@@ -246,6 +250,11 @@ bson_t *_mongocrypt_tester_file_as_bson(_mongocrypt_tester_t *tester, const char
|
|
246
250
|
#define TEST_FILE_AS_BSON(path) _mongocrypt_tester_file_as_bson(tester, path)
|
247
251
|
|
248
252
|
/* Get a temporary binary from a JSON string. Do not free it. */
|
253
|
+
mongocrypt_binary_t *_mongocrypt_tester_bin_from_str(_mongocrypt_tester_t *tester, const char *json);
|
254
|
+
#define TEST_BSON_STR(...) _mongocrypt_tester_bin_from_str(tester, __VA_ARGS__)
|
255
|
+
|
256
|
+
/* Get a temporary binary from a formattable JSON string. Do not free it. */
|
257
|
+
MLIB_ANNOTATE_PRINTF(2, 3)
|
249
258
|
mongocrypt_binary_t *_mongocrypt_tester_bin_from_json(_mongocrypt_tester_t *tester, const char *json, ...);
|
250
259
|
#define TEST_BSON(...) _mongocrypt_tester_bin_from_json(tester, __VA_ARGS__)
|
251
260
|
|
@@ -387,7 +387,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
387
387
|
{
|
388
388
|
mongocrypt_t *crypt = mongocrypt_new();
|
389
389
|
mongocrypt_binary_t *kms_providers =
|
390
|
-
TEST_BSON(BSON_STR({"local" : {}, "local:name1" : {"key" : "%s"}}), LOCAL_KEK1_BASE64
|
390
|
+
TEST_BSON(BSON_STR({"local" : {}, "local:name1" : {"key" : "%s"}}), LOCAL_KEK1_BASE64);
|
391
391
|
ASSERT_OK(mongocrypt_setopt_kms_providers(crypt, kms_providers), crypt);
|
392
392
|
mongocrypt_setopt_use_need_kms_credentials_state(crypt);
|
393
393
|
ASSERT_OK(_mongocrypt_init_for_test(crypt), crypt);
|
@@ -425,7 +425,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
425
425
|
bson_t out_bson;
|
426
426
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
427
427
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "local:name1"}});
|
428
|
-
_assert_match_bson(&out_bson,
|
428
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
429
429
|
bson_destroy(&out_bson);
|
430
430
|
mongocrypt_binary_destroy(out);
|
431
431
|
mongocrypt_ctx_destroy(ctx);
|
@@ -491,7 +491,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
491
491
|
bson_t out_bson;
|
492
492
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
493
493
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "azure:name1"}});
|
494
|
-
_assert_match_bson(&out_bson,
|
494
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
495
495
|
bson_destroy(&out_bson);
|
496
496
|
mongocrypt_binary_destroy(out);
|
497
497
|
mongocrypt_ctx_destroy(ctx);
|
@@ -536,7 +536,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
536
536
|
bson_t out_bson;
|
537
537
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
538
538
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "azure:name1"}});
|
539
|
-
_assert_match_bson(&out_bson,
|
539
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
540
540
|
bson_destroy(&out_bson);
|
541
541
|
mongocrypt_binary_destroy(out);
|
542
542
|
mongocrypt_ctx_destroy(ctx);
|
@@ -611,7 +611,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
611
611
|
bson_t out_bson;
|
612
612
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
613
613
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "azure:name1"}});
|
614
|
-
_assert_match_bson(&out_bson,
|
614
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
615
615
|
bson_destroy(&out_bson);
|
616
616
|
mongocrypt_binary_destroy(out);
|
617
617
|
mongocrypt_ctx_destroy(ctx);
|
@@ -664,7 +664,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
664
664
|
bson_t out_bson;
|
665
665
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
666
666
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "azure:name2"}});
|
667
|
-
_assert_match_bson(&out_bson,
|
667
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
668
668
|
bson_destroy(&out_bson);
|
669
669
|
mongocrypt_binary_destroy(out);
|
670
670
|
mongocrypt_ctx_destroy(ctx);
|
@@ -717,7 +717,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
717
717
|
bson_t out_bson;
|
718
718
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
719
719
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "kmip:name1"}});
|
720
|
-
_assert_match_bson(&out_bson,
|
720
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
721
721
|
bson_destroy(&out_bson);
|
722
722
|
mongocrypt_binary_destroy(out);
|
723
723
|
mongocrypt_ctx_destroy(ctx);
|
@@ -810,7 +810,7 @@ static void test_create_datakey_with_named_kms_provider(_mongocrypt_tester_t *te
|
|
810
810
|
bson_t out_bson;
|
811
811
|
ASSERT(_mongocrypt_binary_to_bson(out, &out_bson));
|
812
812
|
char *pattern = BSON_STR({"masterKey" : {"provider" : "kmip:name1"}});
|
813
|
-
_assert_match_bson(&out_bson,
|
813
|
+
_assert_match_bson(&out_bson, TMP_BSON_STR(pattern));
|
814
814
|
bson_destroy(&out_bson);
|
815
815
|
mongocrypt_binary_destroy(out);
|
816
816
|
mongocrypt_ctx_destroy(ctx);
|
@@ -2119,7 +2119,7 @@ static void test_rewrap_with_named_kms_provider_local2local(_mongocrypt_tester_t
|
|
2119
2119
|
bson_t bin_bson;
|
2120
2120
|
ASSERT(_mongocrypt_binary_to_bson(bin, &bin_bson));
|
2121
2121
|
char *pattern = BSON_STR({"v" : [ {"masterKey" : {"provider" : "local:name2"}} ]});
|
2122
|
-
_assert_match_bson(&bin_bson,
|
2122
|
+
_assert_match_bson(&bin_bson, TMP_BSON_STR(pattern));
|
2123
2123
|
}
|
2124
2124
|
mongocrypt_binary_destroy(bin);
|
2125
2125
|
mongocrypt_ctx_destroy(ctx);
|
@@ -2242,7 +2242,7 @@ static void test_rewrap_with_named_kms_provider_azure2azure(_mongocrypt_tester_t
|
|
2242
2242
|
bson_t bin_bson;
|
2243
2243
|
ASSERT(_mongocrypt_binary_to_bson(bin, &bin_bson));
|
2244
2244
|
char *pattern = BSON_STR({"v" : [ {"masterKey" : {"provider" : "azure:name2"}} ]});
|
2245
|
-
_assert_match_bson(&bin_bson,
|
2245
|
+
_assert_match_bson(&bin_bson, TMP_BSON_STR(pattern));
|
2246
2246
|
}
|
2247
2247
|
mongocrypt_binary_destroy(bin);
|
2248
2248
|
mongocrypt_ctx_destroy(ctx);
|
@@ -2330,7 +2330,7 @@ static void test_rewrap_with_named_kms_provider_azure2local(_mongocrypt_tester_t
|
|
2330
2330
|
bson_t bin_bson;
|
2331
2331
|
ASSERT(_mongocrypt_binary_to_bson(bin, &bin_bson));
|
2332
2332
|
char *pattern = BSON_STR({"v" : [ {"masterKey" : {"provider" : "local:name1"}} ]});
|
2333
|
-
_assert_match_bson(&bin_bson,
|
2333
|
+
_assert_match_bson(&bin_bson, TMP_BSON_STR(pattern));
|
2334
2334
|
}
|
2335
2335
|
mongocrypt_binary_destroy(bin);
|
2336
2336
|
mongocrypt_ctx_destroy(ctx);
|
@@ -49,7 +49,7 @@
|
|
49
49
|
_both_len, \
|
50
50
|
input, \
|
51
51
|
_input_len, \
|
52
|
-
kUnicodeFoldToLower | kUnicodeFoldRemoveDiacritics);
|
52
|
+
(unicode_fold_options_t)(kUnicodeFoldToLower | kUnicodeFoldRemoveDiacritics)); \
|
53
53
|
} while (0)
|
54
54
|
|
55
55
|
static void test_unicode_fold(_mongocrypt_tester_t *tester) {
|
@@ -85,7 +85,11 @@ static void test_unicode_fold(_mongocrypt_tester_t *tester) {
|
|
85
85
|
TEST_UNICODE_FOLD_ALL_CASES("Cafe\xcc\x81", "cafe\xcc\x81", "Cafe", "cafe");
|
86
86
|
TEST_UNICODE_FOLD_ALL_CASES("CafE\xcc\x81", "cafe\xcc\x81", "CafE", "cafe");
|
87
87
|
// Test string with null bytes
|
88
|
-
TEST_UNICODE_FOLD("fo\0bar",
|
88
|
+
TEST_UNICODE_FOLD("fo\0bar",
|
89
|
+
6,
|
90
|
+
"fo\0bar",
|
91
|
+
6,
|
92
|
+
(unicode_fold_options_t)(kUnicodeFoldToLower | kUnicodeFoldRemoveDiacritics));
|
89
93
|
// Test strings with folded representations longer in bytes than the input
|
90
94
|
TEST_UNICODE_FOLD("\xe2\xb1\xa6", 3, "\xc8\xbe", 2, kUnicodeFoldToLower);
|
91
95
|
TEST_UNICODE_FOLD("\xf0\xa4\x8b\xae", 4, "\xef\xa9\xac", 3, kUnicodeFoldRemoveDiacritics);
|
@@ -101,4 +101,4 @@
|
|
101
101
|
"csfle auto_decrypt --document '{ 'insert' : 'coll', 'documents' : [ { 'ssn' : { '$binary' : { 'base64': 'ARG+PK8ud0RZlDIzKwQmFoMCOuSIPyrfYleSqMZRXgaPCQOAurv0LTLNL6Tn/G7TuVOyf/Qv3j6VxSxCQEeu/yO7vv/UDE5niDE0itjOqjmf5Q==', 'subType' : '06' } } } ] }'\n"
|
102
102
|
"\n"
|
103
103
|
"csfle explicit_encrypt --key_id 'Eb48ry53RFmUMjMrBCYWgw==' --value '{'v': 'test'}' --algorithm 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'\n"
|
104
|
-
"```\n"
|
104
|
+
"```\n"
|
@@ -50,7 +50,7 @@ void _errexit_ctx(mongocrypt_ctx_t *ctx, int line) {
|
|
50
50
|
}
|
51
51
|
|
52
52
|
void _errexit_bson(bson_error_t *error, int line) {
|
53
|
-
MONGOC_ERROR("Error at line %d with code %
|
53
|
+
MONGOC_ERROR("Error at line %d with code %" PRIu32 " and msg: %s", line, error->code, error->message);
|
54
54
|
exit(1);
|
55
55
|
}
|
56
56
|
|
@@ -111,7 +111,7 @@ static void _status_to_error(mongocrypt_status_t *status, bson_error_t *error) {
|
|
111
111
|
* Returns true if ok, and does not modify @error.
|
112
112
|
* Returns false if error, and sets @error.
|
113
113
|
*/
|
114
|
-
bool _test_ctx_check_error(mongocrypt_ctx_t *ctx, bson_error_t *error, bool error_expected) {
|
114
|
+
static bool _test_ctx_check_error(mongocrypt_ctx_t *ctx, bson_error_t *error, bool error_expected) {
|
115
115
|
mongocrypt_status_t *status;
|
116
116
|
|
117
117
|
status = mongocrypt_status_new();
|
@@ -131,7 +131,7 @@ bool _test_ctx_check_error(mongocrypt_ctx_t *ctx, bson_error_t *error, bool erro
|
|
131
131
|
return true;
|
132
132
|
}
|
133
133
|
|
134
|
-
bool _test_kms_ctx_check_error(mongocrypt_kms_ctx_t *kms_ctx, bson_error_t *error, bool error_expected) {
|
134
|
+
static bool _test_kms_ctx_check_error(mongocrypt_kms_ctx_t *kms_ctx, bson_error_t *error, bool error_expected) {
|
135
135
|
mongocrypt_status_t *status;
|
136
136
|
|
137
137
|
status = mongocrypt_status_new();
|
@@ -659,7 +659,7 @@ fail:
|
|
659
659
|
return ret;
|
660
660
|
}
|
661
661
|
|
662
|
-
const char *_state_string(mongocrypt_ctx_state_t state) {
|
662
|
+
static const char *_state_string(mongocrypt_ctx_state_t state) {
|
663
663
|
switch (state) {
|
664
664
|
case MONGOCRYPT_CTX_ERROR: return "MONGOCRYPT_CTX_ERROR";
|
665
665
|
case MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB: return "MONGOCRYPT_CTX_NEED_MONGO_COLLINFO_WITH_DB";
|
@@ -732,7 +732,7 @@ bool _csfle_state_machine_run(_state_machine_t *state_machine, bson_t *result, b
|
|
732
732
|
goto fail;
|
733
733
|
}
|
734
734
|
break;
|
735
|
-
case MONGOCRYPT_CTX_DONE: goto success;
|
735
|
+
case MONGOCRYPT_CTX_DONE: goto success;
|
736
736
|
}
|
737
737
|
}
|
738
738
|
|
@@ -20,19 +20,20 @@
|
|
20
20
|
#include <mongoc/mongoc.h>
|
21
21
|
|
22
22
|
void _errexit_mongocrypt(mongocrypt_t *crypt, int line);
|
23
|
-
#define ERREXIT_MONGOCRYPT(crypt) _errexit_mongocrypt(crypt, __LINE__)
|
23
|
+
#define ERREXIT_MONGOCRYPT(crypt) _errexit_mongocrypt(crypt, __LINE__)
|
24
24
|
|
25
25
|
void _errexit_ctx(mongocrypt_ctx_t *ctx, int line);
|
26
|
-
#define ERREXIT_CTX(ctx) _errexit_ctx(ctx, __LINE__)
|
26
|
+
#define ERREXIT_CTX(ctx) _errexit_ctx(ctx, __LINE__)
|
27
27
|
|
28
28
|
void _errexit_bson(bson_error_t *error, int line);
|
29
|
-
#define ERREXIT_BSON(err) _errexit_bson(err, __LINE__)
|
29
|
+
#define ERREXIT_BSON(err) _errexit_bson(err, __LINE__)
|
30
30
|
|
31
31
|
#define ERREXIT(...) \
|
32
|
-
|
32
|
+
if (1) { \
|
33
33
|
MONGOC_ERROR(__VA_ARGS__); \
|
34
34
|
abort(); \
|
35
|
-
}
|
35
|
+
} else \
|
36
|
+
((void)0)
|
36
37
|
|
37
38
|
void _log_to_stdout(mongocrypt_log_level_t level, const char *message, uint32_t message_len, void *ctx);
|
38
39
|
|
@@ -71,4 +72,4 @@ bson_t *bson_get_json(bson_t *bson, const char *key);
|
|
71
72
|
|
72
73
|
bson_t *bson_req_json(bson_t *bson, const char *key);
|
73
74
|
|
74
|
-
bool bson_get_bool(bson_t *bson, const char *key, bool default_value);
|
75
|
+
bool bson_get_bool(bson_t *bson, const char *key, bool default_value);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libmongocrypt-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0.0.1001
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The MongoDB Ruby Team
|
@@ -42,12 +42,11 @@ files:
|
|
42
42
|
- ext/libmongocrypt/libmongocrypt/bindings/cs/README.md
|
43
43
|
- ext/libmongocrypt/libmongocrypt/bindings/node/README.md
|
44
44
|
- ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst
|
45
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/CONTRIBUTING.md
|
45
46
|
- ext/libmongocrypt/libmongocrypt/bindings/python/LICENSE
|
46
47
|
- ext/libmongocrypt/libmongocrypt/bindings/python/README.rst
|
47
48
|
- ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst
|
48
|
-
- ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh
|
49
49
|
- ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py
|
50
|
-
- ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt
|
51
50
|
- ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py
|
52
51
|
- ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py
|
53
52
|
- ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py
|
@@ -70,12 +69,16 @@ files:
|
|
70
69
|
- ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py
|
71
70
|
- ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py
|
72
71
|
- ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml
|
73
|
-
- ext/libmongocrypt/libmongocrypt/bindings/python/release.sh
|
74
72
|
- ext/libmongocrypt/libmongocrypt/bindings/python/requirements-test.txt
|
75
73
|
- ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt
|
76
74
|
- ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json
|
77
|
-
- ext/libmongocrypt/libmongocrypt/bindings/python/
|
78
|
-
- ext/libmongocrypt/libmongocrypt/bindings/python/
|
75
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/build-manylinux-wheel.sh
|
76
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/libmongocrypt-version.txt
|
77
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/release.sh
|
78
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/synchro.py
|
79
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/synchro.sh
|
80
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update-version.sh
|
81
|
+
- ext/libmongocrypt/libmongocrypt/bindings/python/scripts/update_binding.py
|
79
82
|
- ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py
|
80
83
|
- ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json
|
81
84
|
- ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command-reply.json
|
@@ -112,7 +115,6 @@ files:
|
|
112
115
|
- ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py
|
113
116
|
- ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py
|
114
117
|
- ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py
|
115
|
-
- ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh
|
116
118
|
- ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake
|
117
119
|
- ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake
|
118
120
|
- ext/libmongocrypt/libmongocrypt/cmake/ImportDFP.cmake
|
@@ -435,6 +437,8 @@ files:
|
|
435
437
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h
|
436
438
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c
|
437
439
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c
|
440
|
+
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload-private.h
|
441
|
+
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-text-payload.c
|
438
442
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h
|
439
443
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h
|
440
444
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c
|
@@ -455,6 +459,8 @@ files:
|
|
455
459
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block-private.h
|
456
460
|
- ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block.c
|
457
461
|
- ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h
|
462
|
+
- ext/libmongocrypt/libmongocrypt/src/mc-parse-utils-private.h
|
463
|
+
- ext/libmongocrypt/libmongocrypt/src/mc-parse-utils.c
|
458
464
|
- ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h
|
459
465
|
- ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c
|
460
466
|
- ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h
|
@@ -573,7 +579,6 @@ files:
|
|
573
579
|
- ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json
|
574
580
|
- ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json
|
575
581
|
- ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json
|
576
|
-
- ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json
|
577
582
|
- ext/libmongocrypt/libmongocrypt/test/data/collection-info-no-validator.json
|
578
583
|
- ext/libmongocrypt/libmongocrypt/test/data/collection-info-view.json
|
579
584
|
- ext/libmongocrypt/libmongocrypt/test/data/collinfo-siblings.json
|
@@ -591,7 +596,6 @@ files:
|
|
591
596
|
- ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json
|
592
597
|
- ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json
|
593
598
|
- ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json
|
594
|
-
- ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json
|
595
599
|
- ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/cmd-to-mongocryptd.json
|
596
600
|
- ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/cmd.json
|
597
601
|
- ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/collinfo.json
|
@@ -627,18 +631,17 @@ files:
|
|
627
631
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1EncryptionPlaceholder.json
|
628
632
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1RandomEncryptedValue.json
|
629
633
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EncryptionPlaceholder.json
|
630
|
-
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EqualityIndexedValueV2.json
|
631
634
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2FindEqualityPayload.json
|
632
635
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2FindEqualityPayloadV2.json
|
633
636
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedEqualityEncryptedValue.json
|
634
637
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedEqualityEncryptedValueV2.json
|
635
638
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedRangeEncryptedValue.json
|
636
639
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedRangeEncryptedValueV2.json
|
637
|
-
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload-
|
638
|
-
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload-with-edges.json
|
640
|
+
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload-RangeV1.json
|
639
641
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload.json
|
642
|
+
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV1.json
|
643
|
+
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2-RangeV2.json
|
640
644
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2.json
|
641
|
-
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2RangeIndexedValueV2.json
|
642
645
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2UnindexedEncryptedValue.json
|
643
646
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2UnindexedEncryptedValueV2.json
|
644
647
|
- ext/libmongocrypt/libmongocrypt/test/data/explicit-decryption-input.json
|
@@ -1108,6 +1111,7 @@ files:
|
|
1108
1111
|
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-encryption-placeholder.c
|
1109
1112
|
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c
|
1110
1113
|
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c
|
1114
|
+
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-text-payload.c
|
1111
1115
|
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c
|
1112
1116
|
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c
|
1113
1117
|
- ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c
|
@@ -1 +0,0 @@
|
|
1
|
-
1.12.0
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Copyright 2019-present MongoDB, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
"""Generate a CFFI.cdef() string from a C header file
|
16
|
-
|
17
|
-
Usage (on macOS):: python strip_header.py ../../src/mongocrypt.h | pbcopy
|
18
|
-
"""
|
19
|
-
|
20
|
-
import itertools
|
21
|
-
import re
|
22
|
-
import sys
|
23
|
-
|
24
|
-
DROP_RE = re.compile(r"^\s*(#|MONGOCRYPT_EXPORT)")
|
25
|
-
|
26
|
-
|
27
|
-
def strip_file(content):
|
28
|
-
fold = content.replace("\\\n", " ")
|
29
|
-
all_lines = [*fold.split("\n"), ""]
|
30
|
-
keep_lines = (line for line in all_lines if not DROP_RE.match(line))
|
31
|
-
fin = ""
|
32
|
-
for line, peek in itertools.pairwise(keep_lines):
|
33
|
-
if peek == "" and line == "":
|
34
|
-
# Drop adjacent empty lines
|
35
|
-
continue
|
36
|
-
yield line
|
37
|
-
fin = peek
|
38
|
-
yield fin
|
39
|
-
|
40
|
-
|
41
|
-
def strip(hdr):
|
42
|
-
with open(hdr) as fp:
|
43
|
-
out = strip_file(fp.read())
|
44
|
-
print("\n".join(out)) # noqa: T201
|
45
|
-
|
46
|
-
|
47
|
-
if __name__ == "__main__":
|
48
|
-
if len(sys.argv) != 2:
|
49
|
-
raise Exception("Usage: strip_header.py header.h")
|
50
|
-
strip(sys.argv[1])
|