diff --git a/.evergreen/build_all.sh b/.evergreen/build_all.sh index efb406bbe..eafe97430 100755 --- a/.evergreen/build_all.sh +++ b/.evergreen/build_all.sh @@ -38,8 +38,8 @@ mkdir cmake-build cd cmake-build for suffix in "dll" "dylib" "so"; do - if test -f "mongo_csfle_v1.$suffix"; then - ADDITIONAL_CMAKE_FLAGS="$ADDITIONAL_CMAKE_FLAGS -DMONGOCRYPT_TESTING_CSFLE_FILE=$PWD/mongo_csfle_v1.$suffix" + if test -f "mongo_crypt_v1.$suffix"; then + ADDITIONAL_CMAKE_FLAGS="$ADDITIONAL_CMAKE_FLAGS -DMONGOCRYPT_TESTING_CRYPT_SHARED_FILE=$PWD/mongo_crypt_v1.$suffix" fi done diff --git a/CMakeLists.txt b/CMakeLists.txt index 995d6021f..fa703ec10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,39 +327,39 @@ if (BUILD_TESTING) PREFIX "" ) - # Create two stubbed csfle libraries - add_library (stubbed-csfle SHARED test/csfle-stub.cpp) - add_library (stubbed-csfle-2 SHARED test/csfle-stub.cpp) + # Create two stubbed crypt_shared libraries + add_library (stubbed-crypt_shared SHARED test/crypt_shared-stub.cpp) + add_library (stubbed-crypt_shared-2 SHARED test/crypt_shared-stub.cpp) - set_target_properties(stubbed-csfle stubbed-csfle-2 PROPERTIES + set_target_properties(stubbed-crypt_shared stubbed-crypt_shared-2 PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/src" LINK_LIBRARIES "mongo::bson_static" COMPILE_FEATURES cxx_std_11 PREFIX "" ) - set_target_properties(stubbed-csfle-2 PROPERTIES SUFFIX ".dll") + set_target_properties(stubbed-crypt_shared-2 PROPERTIES SUFFIX ".dll") - if (MONGOCRYPT_TESTING_CSFLE_FILE) + if (MONGOCRYPT_TESTING_CRYPT_SHARED_FILE) # Generate a target that copies the CSFLE library into the binary directory of test-mongocrypt - set (stamp "${CMAKE_CURRENT_BINARY_DIR}/mongo_csfle_v1.copied.$.stamp") + set (stamp "${CMAKE_CURRENT_BINARY_DIR}/mongo_crypt_v1.copied.$.stamp") add_custom_command ( OUTPUT "${stamp}" COMMAND "${CMAKE_COMMAND}" -E copy - "${MONGOCRYPT_TESTING_CSFLE_FILE}" - "$/mongo_csfle_v1${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${MONGOCRYPT_TESTING_CRYPT_SHARED_FILE}" + "$/mongo_crypt_v1${CMAKE_SHARED_LIBRARY_SUFFIX}" COMMAND "${CMAKE_COMMAND}" -E touch "${stamp}" - DEPENDS "${MONGOCRYPT_TESTING_CSFLE_FILE}" - COMMENT "Getting mongo_csfle library" + DEPENDS "${MONGOCRYPT_TESTING_CRYPT_SHARED_FILE}" + COMMENT "Getting mongo_crypt library" ) - add_custom_target (copy-csfle ALL DEPENDS "${stamp}") + add_custom_target (copy-crypt_shared ALL DEPENDS "${stamp}") else () - # The first stubbed csfle library will take the place of the actual csfle for testing - message (STATUS "Generating a stubbed csfle dynamic library for use in testing.") - message (STATUS "Provide a MONGOCRYPT_TESTING_CSFLE_FILE= to provide a csfle for use in testing") - set_target_properties (stubbed-csfle PROPERTIES + # The first stubbed crypt_shared library will take the place of the actual crypt_shared for testing + message (STATUS "Generating a stubbed crypt_shared dynamic library for use in testing.") + message (STATUS "Provide a MONGOCRYPT_TESTING_CRYPT_SHARED_FILE= to provide a crypt_shared for use in testing") + set_target_properties (stubbed-crypt_shared PROPERTIES # Normalize the output name expected by libmongocrypt - OUTPUT_NAME "mongo_csfle_v1" + OUTPUT_NAME "mongo_crypt_v1" ) endif () endif () @@ -415,7 +415,7 @@ target_compile_definitions (test-mongocrypt PRIVATE # Set a definition so that testcases can know where test-mongocrypt.exe was written to "TEST_MONGOCRYPT_OUTPUT_PATH=\"$\"" # Tell test-mongocrypt whether we have a real csfle library for testing - TEST_MONGOCRYPT_HAVE_REAL_CSFLE=$ + TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB=$ ) add_test ( diff --git a/bindings/node/lib/autoEncrypter.js b/bindings/node/lib/autoEncrypter.js index 107903311..6764113e0 100644 --- a/bindings/node/lib/autoEncrypter.js +++ b/bindings/node/lib/autoEncrypter.js @@ -126,34 +126,39 @@ module.exports = function (modules) { mongoCryptOptions.logger = options.logger; } - if (options.extraOptions && options.extraOptions.csflePath) { - mongoCryptOptions.csflePath = options.extraOptions.csflePath; + if (options.extraOptions && options.extraOptions.cryptSharedLibPath) { + mongoCryptOptions.cryptSharedLibPath = options.extraOptions.cryptSharedLibPath; } if (options.bypassQueryAnalysis) { mongoCryptOptions.bypassQueryAnalysis = options.bypassQueryAnalysis; } - this._bypassMongocryptdAndCSFLE = this._bypassEncryption || options.bypassQueryAnalysis; + this._bypassMongocryptdAndCryptShared = this._bypassEncryption || options.bypassQueryAnalysis; - if (options.extraOptions && options.extraOptions.csfleSearchPaths) { + if (options.extraOptions && options.extraOptions.cryptSharedLibSearchPaths) { // Only for driver testing - mongoCryptOptions.csfleSearchPaths = options.extraOptions.csfleSearchPaths; - } else if (!this._bypassMongocryptdAndCSFLE) { - mongoCryptOptions.csfleSearchPaths = ['$SYSTEM']; + mongoCryptOptions.cryptSharedLibSearchPaths = + options.extraOptions.cryptSharedLibSearchPaths; + } else if (!this._bypassMongocryptdAndCryptShared) { + mongoCryptOptions.cryptSharedLibSearchPaths = ['$SYSTEM']; } Object.assign(mongoCryptOptions, { cryptoCallbacks }); this._mongocrypt = new mc.MongoCrypt(mongoCryptOptions); this._contextCounter = 0; - if (options.extraOptions && options.extraOptions.csfleRequired && !this.csfleVersionInfo) { - throw new MongoError('`csfleRequired` set but no csfle shared library loaded'); + if ( + options.extraOptions && + options.extraOptions.cryptSharedLibRequired && + !this.cryptSharedLibVersionInfo + ) { + throw new MongoError('`cryptSharedLibRequired` set but no crypt_shared library loaded'); } // Only instantiate mongocryptd manager/client once we know for sure // that we are not using the CSFLE shared library. - if (!this._bypassMongocryptdAndCSFLE && !this.csfleVersionInfo) { + if (!this._bypassMongocryptdAndCryptShared && !this.cryptSharedLibVersionInfo) { this._mongocryptdManager = new MongocryptdManager(options.extraOptions); this._mongocryptdClient = new MongoClient(this._mongocryptdManager.uri, { useNewUrlParser: true, @@ -168,7 +173,7 @@ module.exports = function (modules) { * @param {Function} callback Invoked when the mongocryptd client either successfully connects or errors */ init(callback) { - if (this._bypassMongocryptdAndCSFLE || this.csfleVersionInfo) { + if (this._bypassMongocryptdAndCryptShared || this.cryptSharedLibVersionInfo) { return callback(); } const _callback = (err, res) => { @@ -323,8 +328,8 @@ module.exports = function (modules) { * as `{ version: bigint, versionStr: string }`, or `null` if no CSFLE * shared library was loaded. */ - get csfleVersionInfo() { - return this._mongocrypt.csfleVersionInfo; + get cryptSharedLibVersionInfo() { + return this._mongocrypt.cryptSharedLibVersionInfo; } } diff --git a/bindings/node/src/mongocrypt.cc b/bindings/node/src/mongocrypt.cc index e7f9c6951..387f8171b 100644 --- a/bindings/node/src/mongocrypt.cc +++ b/bindings/node/src/mongocrypt.cc @@ -110,7 +110,7 @@ Function MongoCrypt::Init(Napi::Env env) { InstanceMethod("makeDataKeyContext", &MongoCrypt::MakeDataKeyContext), InstanceMethod("makeRewrapManyDataKeyContext", &MongoCrypt::MakeRewrapManyDataKeyContext), InstanceAccessor("status", &MongoCrypt::Status, nullptr), - InstanceAccessor("csfleVersionInfo", &MongoCrypt::CSFLEVersionInfo, nullptr) + InstanceAccessor("cryptSharedLibVersionInfo", &MongoCrypt::CryptSharedLibVersionInfo, nullptr) }); } @@ -449,23 +449,23 @@ MongoCrypt::MongoCrypt(const CallbackInfo& info) } } - if (options.Has("csfleSearchPaths")) { - Napi::Value search_paths_v = options["csfleSearchPaths"]; + if (options.Has("cryptSharedLibSearchPaths")) { + Napi::Value search_paths_v = options["cryptSharedLibSearchPaths"]; if (!search_paths_v.IsArray()) { - throw TypeError::New(Env(), "Option `csfleSearchPaths` must be an array"); + throw TypeError::New(Env(), "Option `cryptSharedLibSearchPaths` must be an array"); } Array search_paths = search_paths_v.As(); for (uint32_t i = 0; i < search_paths.Length(); i++) { - mongocrypt_setopt_append_csfle_search_path( + mongocrypt_setopt_append_crypt_shared_lib_search_path( _mongo_crypt.get(), search_paths.Get(i).ToString().Utf8Value().c_str()); } } - if (options.Has("csflePath")) { - mongocrypt_setopt_set_csfle_lib_path_override( + if (options.Has("cryptSharedLibPath")) { + mongocrypt_setopt_set_crypt_shared_lib_path_override( _mongo_crypt.get(), - options.Get("csflePath").ToString().Utf8Value().c_str()); + options.Get("cryptSharedLibPath").ToString().Utf8Value().c_str()); } if (options.Get("bypassQueryAnalysis").ToBoolean()) { @@ -480,9 +480,9 @@ MongoCrypt::MongoCrypt(const CallbackInfo& info) } } -Value MongoCrypt::CSFLEVersionInfo(const CallbackInfo& info) { - uint64_t version_numeric = mongocrypt_csfle_version(_mongo_crypt.get()); - const char* version_string = mongocrypt_csfle_version_string(_mongo_crypt.get(), nullptr); +Value MongoCrypt::CryptSharedLibVersionInfo(const CallbackInfo& info) { + uint64_t version_numeric = mongocrypt_crypt_shared_lib_version(_mongo_crypt.get()); + const char* version_string = mongocrypt_crypt_shared_lib_version_string(_mongo_crypt.get(), nullptr); if (version_string == nullptr) { return Env().Null(); } diff --git a/bindings/node/src/mongocrypt.h b/bindings/node/src/mongocrypt.h index 8e79eca6b..b960e5000 100644 --- a/bindings/node/src/mongocrypt.h +++ b/bindings/node/src/mongocrypt.h @@ -48,7 +48,7 @@ class MongoCrypt : public Napi::ObjectWrap { Napi::Value MakeRewrapManyDataKeyContext(const Napi::CallbackInfo& info); Napi::Value Status(const Napi::CallbackInfo& info); - Napi::Value CSFLEVersionInfo(const Napi::CallbackInfo& info); + Napi::Value CryptSharedLibVersionInfo(const Napi::CallbackInfo& info); private: friend class Napi::ObjectWrap; diff --git a/bindings/node/test/autoEncrypter.test.js b/bindings/node/test/autoEncrypter.test.js index 11a6dded8..809b6b517 100644 --- a/bindings/node/test/autoEncrypter.test.js +++ b/bindings/node/test/autoEncrypter.test.js @@ -25,7 +25,7 @@ let sharedLibraryStub = path.resolve( '..', '..', '..', - `mongo_csfle_v1.${sharedLibrarySuffix}` + `mongo_crypt_v1.${sharedLibrarySuffix}` ); if (!fs.existsSync(sharedLibraryStub)) { sharedLibraryStub = path.resolve( @@ -35,7 +35,7 @@ if (!fs.existsSync(sharedLibraryStub)) { 'tmp', 'libmongocrypt-build', ...(process.platform === 'win32' ? ['RelWithDebInfo'] : []), - `mongo_csfle_v1.${sharedLibrarySuffix}` + `mongo_crypt_v1.${sharedLibrarySuffix}` ); } @@ -285,7 +285,7 @@ describe('AutoEncrypter', function () { }); // TODO(NODE-4089): Enable test once https://github.com/mongodb/libmongocrypt/pull/263 is done - it.skip('should encrypt mock data when using the CSFLE shared library', function (done) { + it.skip('should encrypt mock data when using the crypt_shared library', function (done) { const client = new MockClient(); const mc = new AutoEncrypter(client, { keyVaultNamespace: 'admin.datakeys', @@ -297,7 +297,7 @@ describe('AutoEncrypter', function () { return { aws: { accessKeyId: 'example', secretAccessKey: 'example' } }; }, extraOptions: { - csflePath: sharedLibraryStub + cryptSharedLibPath: sharedLibraryStub } }); @@ -396,7 +396,7 @@ describe('AutoEncrypter', function () { } }); - expect(this.mc).to.have.property('csfleVersionInfo', null); + expect(this.mc).to.have.property('cryptSharedLibVersionInfo', null); const localMcdm = this.mc._mongocryptdManager; sandbox.spy(localMcdm, 'spawn'); @@ -429,7 +429,7 @@ describe('AutoEncrypter', function () { local: { key: Buffer.alloc(96) } } }); - expect(this.mc).to.have.property('csfleVersionInfo', null); + expect(this.mc).to.have.property('cryptSharedLibVersionInfo', null); const localMcdm = this.mc._mongocryptdManager; this.mc.init(err => { @@ -466,7 +466,7 @@ describe('AutoEncrypter', function () { local: { key: Buffer.alloc(96) } } }); - expect(this.mc).to.have.property('csfleVersionInfo', null); + expect(this.mc).to.have.property('cryptSharedLibVersionInfo', null); const localMcdm = this.mc._mongocryptdManager; this.mc.init(err => { @@ -503,7 +503,7 @@ describe('AutoEncrypter', function () { local: { key: Buffer.alloc(96) } } }); - expect(this.mc).to.have.property('csfleVersionInfo', null); + expect(this.mc).to.have.property('cryptSharedLibVersionInfo', null); const localMcdm = this.mc._mongocryptdManager; this.mc.init(err => { @@ -532,7 +532,7 @@ describe('AutoEncrypter', function () { mongocryptdURI: 'mongodb://something.invalid:27020/' } }); - expect(this.mc).to.have.property('csfleVersionInfo', null); + expect(this.mc).to.have.property('cryptSharedLibVersionInfo', null); sandbox.stub(MongocryptdManager.prototype, 'spawn').callsFake(callback => { callback(); @@ -641,8 +641,8 @@ describe('AutoEncrypter', function () { }); }); - describe('CSFLE shared library', function () { - it('should fail if no library can be found in the search path and csfleRequired is set', function () { + describe('crypt_shared library', function () { + it('should fail if no library can be found in the search path and cryptSharedLibRequired is set', function () { // NB: This test has to be run before the tests/without having previously // loaded a CSFLE shared library below to get the right error path. const client = new MockClient(); @@ -655,13 +655,15 @@ describe('AutoEncrypter', function () { local: { key: Buffer.alloc(96) } }, extraOptions: { - csfleSearchPaths: ['/nonexistent'], - csfleRequired: true + cryptSharedLibSearchPaths: ['/nonexistent'], + cryptSharedLibRequired: true } }); expect.fail('missed exception'); } catch (err) { - expect(err.message).to.include('`csfleRequired` set but no csfle shared library loaded'); + expect(err.message).to.include( + '`cryptSharedLibRequired` set but no crypt_shared library loaded' + ); } }); @@ -675,16 +677,16 @@ describe('AutoEncrypter', function () { local: { key: Buffer.alloc(96) } }, extraOptions: { - csflePath: sharedLibraryStub + cryptSharedLibPath: sharedLibraryStub } }); expect(this.mc).to.not.have.property('_mongocryptdManager'); expect(this.mc).to.not.have.property('_mongocryptdClient'); - expect(this.mc).to.have.deep.property('csfleVersionInfo', { + expect(this.mc).to.have.deep.property('cryptSharedLibVersionInfo', { // eslint-disable-next-line no-undef version: BigInt(0x000600020001000), - versionStr: 'stubbed-mongo_csfle' + versionStr: 'stubbed-crypt_shared' }); this.mc.teardown(true, done); @@ -700,16 +702,16 @@ describe('AutoEncrypter', function () { local: { key: Buffer.alloc(96) } }, extraOptions: { - csfleSearchPaths: [path.dirname(sharedLibraryStub)] + cryptSharedLibSearchPaths: [path.dirname(sharedLibraryStub)] } }); expect(this.mc).to.not.have.property('_mongocryptdManager'); expect(this.mc).to.not.have.property('_mongocryptdClient'); - expect(this.mc).to.have.deep.property('csfleVersionInfo', { + expect(this.mc).to.have.deep.property('cryptSharedLibVersionInfo', { // eslint-disable-next-line no-undef version: BigInt(0x000600020001000), - versionStr: 'stubbed-mongo_csfle' + versionStr: 'stubbed-crypt_shared' }); this.mc.teardown(true, done); diff --git a/bindings/python/.evergreen/test.sh b/bindings/python/.evergreen/test.sh index 3f4a185fa..a45ba0459 100755 --- a/bindings/python/.evergreen/test.sh +++ b/bindings/python/.evergreen/test.sh @@ -23,9 +23,9 @@ if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin "C:/python/Python38/python.exe" "C:/python/Python39/python.exe" "C:/python/Python310/python.exe") - export CSFLE_PATH=../csfle/bin/mongo_csfle_v1.dll - C:/python/Python310/python.exe drivers-evergreen-tools/.evergreen/mongodl.py --component csfle \ - --version latest --out ../csfle/ + export CSFLE_PATH=../crypt_shared/bin/mongo_crypt_v1.dll + C:/python/Python310/python.exe drivers-evergreen-tools/.evergreen/mongodl.py --component crypt_shared \ + --version latest --out ../crypt_shared/ elif [ "Darwin" = "$(uname -s)" ]; then export PYMONGOCRYPT_LIB=${MONGOCRYPT_DIR}/nocrypto/lib/libmongocrypt.dylib PYTHONS=("python" # Python 2.7 from brew @@ -38,9 +38,9 @@ elif [ "Darwin" = "$(uname -s)" ]; then "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3" "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3" "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3") - export CSFLE_PATH="../csfle/lib/mongo_csfle_v1.dylib" - python3 drivers-evergreen-tools/.evergreen/mongodl.py --component csfle \ - --version latest --out ../csfle/ + export CSFLE_PATH="../crypt_shared/lib/mongo_crypt_v1.dylib" + python3 drivers-evergreen-tools/.evergreen/mongodl.py --component crypt_shared \ + --version latest --out ../crypt_shared/ else export PYMONGOCRYPT_LIB=${MONGOCRYPT_DIR}/nocrypto/lib64/libmongocrypt.so PYTHONS=("/opt/python/2.7/bin/python" @@ -49,9 +49,9 @@ else "/opt/python/3.6/bin/python3" "/opt/python/pypy/bin/pypy" "/opt/python/pypy3.6/bin/pypy3") - export CSFLE_PATH="../csfle/lib/mongo_csfle_v1.so" + export CSFLE_PATH="../crypt_shared/lib/mongo_crypt_v1.so" /opt/mongodbtoolchain/v3/bin/python3 drivers-evergreen-tools/.evergreen/mongodl.py --component \ - csfle --version latest --out ../csfle/ --target rhel70 + crypt_shared --version latest --out ../crypt_shared/ --target rhel70 fi diff --git a/bindings/python/pymongocrypt/binding.py b/bindings/python/pymongocrypt/binding.py index 2bc1f8425..b30d050c7 100644 --- a/bindings/python/pymongocrypt/binding.py +++ b/bindings/python/pymongocrypt/binding.py @@ -440,12 +440,12 @@ def _parse_version(version): * then the system's library-search mechanism will never be consulted. * * @note If an absolute path to the library is specified using - * @ref mongocrypt_setopt_set_csfle_lib_path_override, then paths appended here - * will have no effect. + * @ref mongocrypt_setopt_set_crypt_shared_lib_path_override, then paths + * appended here will have no effect. */ void -mongocrypt_setopt_append_csfle_search_path (mongocrypt_t *crypt, - const char *path); +mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt, + const char *path); /** * @brief Set a single override path for loading the CSFLE dynamic library. @@ -462,16 +462,16 @@ def _parse_version(version): * occur during the call to @ref mongocrypt_init. * * @note If a CSFLE library path override is specified here, then no paths given - * to @ref mongocrypt_setopt_append_csfle_search_path will be consulted when - * opening the CSFLE library. + * to @ref mongocrypt_setopt_append_crypt_shared_lib_search_path will be + * consulted when opening the CSFLE library. * * @note If a path is provided via this API and @ref mongocrypt_init fails to * initialize a valid CSFLE library instance for the path specified, then * the initialization of mongocrypt_t will fail with an error. */ void -mongocrypt_setopt_set_csfle_lib_path_override (mongocrypt_t *crypt, - const char *path); +mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt, + const char *path); /** * @brief Opt-into handling the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state. @@ -541,10 +541,11 @@ def _parse_version(version): * @return A nul-terminated string of the dynamically loaded csfle library. * * @note For a numeric value that can be compared against, use - * @ref mongocrypt_csfle_version. + * @ref mongocrypt_crypt_shared_lib_version. */ const char * -mongocrypt_csfle_version_string (const mongocrypt_t *crypt, uint32_t *len); +mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt, + uint32_t *len); /** * @brief Obtain a 64-bit constant encoding the version of the loaded csfle @@ -566,7 +567,7 @@ def _parse_version(version): * For example, version 6.2.1 would be encoded as: 0x0006'0002'0001'0000 */ uint64_t -mongocrypt_csfle_version (const mongocrypt_t *crypt); +mongocrypt_crypt_shared_lib_version (const mongocrypt_t *crypt); /** * Manages the state machine for encryption or decryption. diff --git a/bindings/python/pymongocrypt/mongocrypt.py b/bindings/python/pymongocrypt/mongocrypt.py index f05cf67fd..22dbae65d 100644 --- a/bindings/python/pymongocrypt/mongocrypt.py +++ b/bindings/python/pymongocrypt/mongocrypt.py @@ -36,8 +36,8 @@ class MongoCryptOptions(object): def __init__(self, kms_providers, schema_map=None, encrypted_fields_map=None, - bypass_query_analysis=False, csfle_path=None, csfle_required=False, - bypass_encryption=False): + bypass_query_analysis=False, crypt_shared_lib_path=None, + crypt_shared_lib_required=False, bypass_encryption=False): """Options for :class:`MongoCrypt`. :Parameters: @@ -71,7 +71,7 @@ def __init__(self, kms_providers, schema_map=None, encrypted_fields_map=None, - `bypass_query_analysis`: If ``True``, disable automatic analysis of outgoing commands. Set `bypass_query_analysis` to use explicit encryption on indexed fields without the MongoDB Enterprise Advanced - licensed csfle shared library. + licensed crypt_shared library. .. versionadded:: 1.1 Support for "azure" and "gcp" kms_providers. @@ -149,8 +149,8 @@ def __init__(self, kms_providers, schema_map=None, encrypted_fields_map=None, self.schema_map = schema_map self.encrypted_fields_map = encrypted_fields_map self.bypass_query_analysis = bypass_query_analysis - self.csfle_path = csfle_path - self.csfle_required = csfle_required + self.crypt_shared_lib_path = crypt_shared_lib_path + self.crypt_shared_lib_required = crypt_shared_lib_required self.bypass_encryption = bypass_encryption @@ -163,7 +163,7 @@ def __init__(self, options, callback): - `options`: A :class:`MongoCryptOptions`. - `callback`: A :class:`MongoCryptCallback`. """ - self.__opts = options + self.__opts = options # type: MongoCryptOptions self.__callback = callback self.__crypt = None @@ -235,20 +235,20 @@ def __init(self): self.__crypt, aes_256_ctr_encrypt, aes_256_ctr_decrypt, ffi.NULL): self.__raise_from_status() - if self.__opts.csfle_path is not None: - lib.mongocrypt_setopt_set_csfle_lib_path_override(self.__crypt, - self.__opts.csfle_path.encode( - "utf-8")) + if self.__opts.crypt_shared_lib_path is not None: + lib.mongocrypt_setopt_set_crypt_shared_lib_path_override( + self.__crypt, self.__opts.crypt_shared_lib_path.encode("utf-8")) if not self.__opts.bypass_encryption: - lib.mongocrypt_setopt_append_csfle_search_path(self.__crypt, b"$SYSTEM") + lib.mongocrypt_setopt_append_crypt_shared_lib_search_path(self.__crypt, b"$SYSTEM") if not lib.mongocrypt_init(self.__crypt): self.__raise_from_status() - if self.__opts.csfle_required and self.csfle_version is None: + if self.__opts.crypt_shared_lib_required and self.crypt_shared_lib_version is None: raise MongoCryptError( - "csfle_required=True but the csfle library could not be loaded from" - " csfle_path={}".format(self.__opts.csfle_path) + + "crypt_shared_lib_required=True but the crypt_shared library could not be loaded " + "from crypt_shared_lib_path={}".format( + self.__opts.crypt_shared_lib_path) + " or the operating system's dynamic library search path") def __raise_from_status(self): @@ -261,8 +261,8 @@ def __raise_from_status(self): raise exc @property - def csfle_version(self): - ver = lib.mongocrypt_csfle_version_string(self.__crypt, ffi.NULL) + def crypt_shared_lib_version(self): + ver = lib.mongocrypt_crypt_shared_lib_version_string(self.__crypt, ffi.NULL) if ver == ffi.NULL: return None return ver diff --git a/bindings/python/test/test_mongocrypt.py b/bindings/python/test/test_mongocrypt.py index 3bdaa138a..9c72b9934 100644 --- a/bindings/python/test/test_mongocrypt.py +++ b/bindings/python/test/test_mongocrypt.py @@ -257,7 +257,7 @@ def _test_kms_context(self, ctx): def test_encrypt(self): mc = self.create_mongocrypt() self.addCleanup(mc.close) - if mc.csfle_version != None: + if mc.crypt_shared_lib_version != None: self.skipTest("This test's assumptions about the state of mongocrypt do not hold when CSFLE is loaded") with mc.encryption_context('text', bson_data('command.json')) as ctx: self.assertEqual(ctx.state, lib.MONGOCRYPT_CTX_NEED_MONGO_COLLINFO) @@ -384,30 +384,30 @@ def test_csfle(self): mc = MongoCrypt(MongoCryptOptions({ 'aws': {'accessKeyId': 'example', 'secretAccessKey': 'example'}, 'local': {'key': b'\x00'*96}}), MockCallback()) - if mc.csfle_version is None: + if mc.crypt_shared_lib_version is None: self.skipTest("This test requires CSFLE.") # Test that we can pick up CSFLE automatically encrypter = AutoEncrypter(MockCallback(), MongoCryptOptions({ 'aws': {'accessKeyId': 'example', 'secretAccessKey': 'example'}, 'local': {'key': b'\x00'*96}}, bypass_encryption=False, - csfle_required=True)) + crypt_shared_lib_required=True)) self.addCleanup(encrypter.close) encrypter = AutoEncrypter(MockCallback(), MongoCryptOptions({ 'aws': {'accessKeyId': 'example', 'secretAccessKey': 'example'}, 'local': {'key': b'\x00' * 96}}, - csfle_path=os.environ["CSFLE_PATH"], - csfle_required=True)) + crypt_shared_lib_path=os.environ["CSFLE_PATH"], + crypt_shared_lib_required=True)) self.addCleanup(encrypter.close) with self.assertRaisesRegex(MongoCryptError, "/doesnotexist"): AutoEncrypter(MockCallback(),MongoCryptOptions({ 'aws': {'accessKeyId': 'example', 'secretAccessKey': 'example'}, 'local': {'key': b'\x00' * 96}}, - csfle_path="/doesnotexist", - csfle_required=True)) + crypt_shared_lib_path="/doesnotexist", + crypt_shared_lib_required=True)) def test_encrypt(self): encrypter = AutoEncrypter(MockCallback( diff --git a/src/csfle-markup.cpp b/src/csfle-markup.cpp index a4fc22cbd..3fb5f8e1b 100644 --- a/src/csfle-markup.cpp +++ b/src/csfle-markup.cpp @@ -13,7 +13,7 @@ extern "C" { #include #include -#include +#include namespace { @@ -132,21 +132,21 @@ do_main (int argc, const char *const *argv) } \ static_assert (true, "") - LOAD_SYM (mongo_csfle_v1_status_create); - LOAD_SYM (mongo_csfle_v1_status_destroy); - LOAD_SYM (mongo_csfle_v1_status_get_explanation); - LOAD_SYM (mongo_csfle_v1_lib_create); - LOAD_SYM (mongo_csfle_v1_lib_destroy); - LOAD_SYM (mongo_csfle_v1_get_version_str); - LOAD_SYM (mongo_csfle_v1_query_analyzer_create); - LOAD_SYM (mongo_csfle_v1_query_analyzer_destroy); - LOAD_SYM (mongo_csfle_v1_analyze_query); - LOAD_SYM (mongo_csfle_v1_bson_free); + LOAD_SYM (mongo_crypt_v1_status_create); + LOAD_SYM (mongo_crypt_v1_status_destroy); + LOAD_SYM (mongo_crypt_v1_status_get_explanation); + LOAD_SYM (mongo_crypt_v1_lib_create); + LOAD_SYM (mongo_crypt_v1_lib_destroy); + LOAD_SYM (mongo_crypt_v1_get_version_str); + LOAD_SYM (mongo_crypt_v1_query_analyzer_create); + LOAD_SYM (mongo_crypt_v1_query_analyzer_destroy); + LOAD_SYM (mongo_crypt_v1_analyze_query); + LOAD_SYM (mongo_crypt_v1_bson_free); fprintf (stderr, "Loaded csfle library [%s]: %s\n", csfle_path, - mongo_csfle_v1_get_version_str ()); + mongo_crypt_v1_get_version_str ()); // Read from stdin std::stringstream strm; @@ -172,37 +172,37 @@ do_main (int argc, const char *const *argv) BSON_APPEND_UTF8 (input, "$db", "unspecified"); } - auto status = mongo_csfle_v1_status_create (); - auto del_status = DEFER ({ mongo_csfle_v1_status_destroy (status); }); + auto status = mongo_crypt_v1_status_create (); + auto del_status = DEFER ({ mongo_crypt_v1_status_destroy (status); }); - auto lib = mongo_csfle_v1_lib_create (status); + auto lib = mongo_crypt_v1_lib_create (status); if (!lib) { fprintf (stderr, "Failed to lib_create for csfle: %s\n", - mongo_csfle_v1_status_get_explanation (status)); + mongo_crypt_v1_status_get_explanation (status)); return 6; } - auto del_lib = DEFER ({ mongo_csfle_v1_lib_destroy (lib, nullptr); }); + auto del_lib = DEFER ({ mongo_crypt_v1_lib_destroy (lib, nullptr); }); - auto qa = mongo_csfle_v1_query_analyzer_create (lib, status); + auto qa = mongo_crypt_v1_query_analyzer_create (lib, status); if (!qa) { fprintf (stderr, "Failed to create a query analyzer for csfle: %s\n", - mongo_csfle_v1_status_get_explanation (status)); + mongo_crypt_v1_status_get_explanation (status)); return 7; } - auto del_qa = DEFER ({ mongo_csfle_v1_query_analyzer_destroy (qa); }); + auto del_qa = DEFER ({ mongo_crypt_v1_query_analyzer_destroy (qa); }); uint32_t data_len = input->len; - uint8_t *data_ptr = mongo_csfle_v1_analyze_query ( + uint8_t *data_ptr = mongo_crypt_v1_analyze_query ( qa, bson_get_data (input), doc_ns, strlen (doc_ns), &data_len, status); if (!data_ptr) { fprintf (stderr, "Failed to analyze the given query: %s\n", - mongo_csfle_v1_status_get_explanation (status)); + mongo_crypt_v1_status_get_explanation (status)); return 8; } - auto del_data = DEFER ({ mongo_csfle_v1_bson_free (data_ptr); }); + auto del_data = DEFER ({ mongo_crypt_v1_bson_free (data_ptr); }); bson_t *output = bson_new_from_data (data_ptr, data_len); assert (output); diff --git a/src/mongo_csfle-v1.h b/src/mongo_crypt-v1.h similarity index 56% rename from src/mongo_csfle-v1.h rename to src/mongo_crypt-v1.h index b4e7b99e1..b489dd378 100644 --- a/src/mongo_csfle-v1.h +++ b/src/mongo_crypt-v1.h @@ -3,8 +3,8 @@ */ -#ifndef CSFLE_SUPPORT_H -#define CSFLE_SUPPORT_H +#ifndef MONGO_CRYPT_SUPPORT_H +#define MONGO_CRYPT_SUPPORT_H #include #include @@ -18,8 +18,8 @@ #pragma push_macro("MONGO_API_EXPORT") #undef MONGO_API_EXPORT -#pragma push_macro("CSFLE_SUPPORT_API") -#undef CSFLE_SUPPORT_API +#pragma push_macro("MONGO_CRYPT_SUPPORT_API") +#undef MONGO_CRYPT_SUPPORT_API #if defined(_WIN32) #define MONGO_API_CALL __cdecl @@ -31,13 +31,13 @@ #define MONGO_API_EXPORT __attribute__((used, visibility("default"))) #endif -#if defined(CSFLE_SUPPORT_STATIC) -#define MONGO_CSFLE_API +#if defined(MONGO_CRYPT_SUPPORT_STATIC) +#define MONGO_CRYPT_API #else -#if defined(CSFLE_SUPPORT_COMPILING) -#define MONGO_CSFLE_API MONGO_API_EXPORT +#if defined(MONGO_CRYPT_SUPPORT_COMPILING) +#define MONGO_CRYPT_API MONGO_API_EXPORT #else -#define MONGO_CSFLE_API MONGO_API_IMPORT +#define MONGO_CRYPT_API MONGO_API_IMPORT #endif #endif @@ -48,40 +48,40 @@ extern "C" { /** * An object which describes the details of the failure of an operation. * - * The CSFLE Library uses allocated objects of this type to report the details of any - * failure, when an operation cannot be completed. Several `mongo_csfle_v1_status` functions are + * The Mongo Crypt Shared Library uses allocated objects of this type to report the details of any + * failure, when an operation cannot be completed. Several `mongo_crypt_v1_status` functions are * provided which permit observing the details of these failures. Further a construction function * and a destruction function for these objects are also provided. * * The use of status objects from multiple threads is not thread safe unless all of the threads * accessing a single status object are passing that object as a const-qualified (const - * mongo_csfle_v1_status *) pointer. If a single thread is passing a status object to a function - * taking it by non-const-qualified (mongo_csfle_v1_status*) pointer, then no other thread may + * mongo_crypt_v1_status *) pointer. If a single thread is passing a status object to a function + * taking it by non-const-qualified (mongo_crypt_v1_status*) pointer, then no other thread may * access the status object. * - * The `status` parameter is optional for all `mongo_csfle_v1_` functions that can take a status + * The `status` parameter is optional for all `mongo_crypt_v1_` functions that can take a status * pointer. The caller may pass NULL instead of a valid `status` object, in which case the function * will execute normally but will not provide any detailed error information in the caes of a * failure. * - * All `mongo_csfle_v1_status` functions can be used before the CSFLE library is + * All `mongo_crypt_v1_status` functions can be used before the Mongo Crypt Shared library is * initialized. This facilitates detailed error reporting from all library functions. */ -typedef struct mongo_csfle_v1_status mongo_csfle_v1_status; +typedef struct mongo_crypt_v1_status mongo_crypt_v1_status; /** * Allocate and construct an API-return-status buffer object. * - * Returns NULL when construction of a mongo_csfle_v1_status object fails. + * Returns NULL when construction of a mongo_crypt_v1_status object fails. * - * This function may be called before mongo_csfle_v1_lib_create(). + * This function may be called before mongo_crypt_v1_lib_create(). */ -MONGO_CSFLE_API mongo_csfle_v1_status* MONGO_API_CALL mongo_csfle_v1_status_create(void); +MONGO_CRYPT_API mongo_crypt_v1_status* MONGO_API_CALL mongo_crypt_v1_status_create(void); /** * Destroys a valid status object. * - * The status object must be a valid mongo_csfle_v1_status object or NULL. + * The status object must be a valid mongo_crypt_v1_status object or NULL. * * This function is not thread safe, and it must not execute concurrently with any other function * that accesses the status object being destroyed. It is, however, safe to destroy distinct status @@ -89,123 +89,123 @@ MONGO_CSFLE_API mongo_csfle_v1_status* MONGO_API_CALL mongo_csfle_v1_status_crea * * This function does not report failures. * - * This function may be called before `mongo_csfle_v1_lib_create()`. + * This function may be called before `mongo_crypt_v1_lib_create()`. * * This function causes all storage associated with the specified status object to be released, * including the storage referenced by functions that returned observable storage buffers from this * status, such as strings. */ -MONGO_CSFLE_API void MONGO_API_CALL mongo_csfle_v1_status_destroy(mongo_csfle_v1_status* status); +MONGO_CRYPT_API void MONGO_API_CALL mongo_crypt_v1_status_destroy(mongo_crypt_v1_status* status); /** - * The error codes reported by `mongo_csfle_v1` functions will be given the symbolic names as + * The error codes reported by `mongo_crypt_v1` functions will be given the symbolic names as * mapped by this enum. * - * When a `mongo_csfle_v1` function fails (and it has been documented to report errors) it will + * When a `mongo_crypt_v1` function fails (and it has been documented to report errors) it will * report that error in the form of an `int` status code. That status code will always be returned * as the type `int`; however, the values in this enum can be used to classify the failure. */ typedef enum { - MONGO_CSFLE_V1_ERROR_IN_REPORTING_ERROR = -2, - MONGO_CSFLE_V1_ERROR_UNKNOWN = -1, + MONGO_CRYPT_V1_ERROR_IN_REPORTING_ERROR = -2, + MONGO_CRYPT_V1_ERROR_UNKNOWN = -1, - MONGO_CSFLE_V1_SUCCESS = 0, + MONGO_CRYPT_V1_SUCCESS = 0, - MONGO_CSFLE_V1_ERROR_ENOMEM = 1, - MONGO_CSFLE_V1_ERROR_EXCEPTION = 2, - MONGO_CSFLE_V1_ERROR_LIBRARY_ALREADY_INITIALIZED = 3, - MONGO_CSFLE_V1_ERROR_LIBRARY_NOT_INITIALIZED = 4, - MONGO_CSFLE_V1_ERROR_INVALID_LIB_HANDLE = 5, - MONGO_CSFLE_V1_ERROR_REENTRANCY_NOT_ALLOWED = 6, -} mongo_csfle_v1_error; + MONGO_CRYPT_V1_ERROR_ENOMEM = 1, + MONGO_CRYPT_V1_ERROR_EXCEPTION = 2, + MONGO_CRYPT_V1_ERROR_LIBRARY_ALREADY_INITIALIZED = 3, + MONGO_CRYPT_V1_ERROR_LIBRARY_NOT_INITIALIZED = 4, + MONGO_CRYPT_V1_ERROR_INVALID_LIB_HANDLE = 5, + MONGO_CRYPT_V1_ERROR_REENTRANCY_NOT_ALLOWED = 6, +} mongo_crypt_v1_error; /** - * Gets an error code from a `mongo_csfle_v1_status` object. + * Gets an error code from a `mongo_crypt_v1_status` object. * - * When a `mongo_csfle_v1` function fails (and it has been documented to report errors) it will + * When a `mongo_crypt_v1` function fails (and it has been documented to report errors) it will * report its error in the form of an `int` status code which is stored into a supplied - * `mongo_csfle_v1_status` object, if provided. Some of these functions may also report extra - * information, which will be reported by other observer functions. Every `mongo_csfle_v1` + * `mongo_crypt_v1_status` object, if provided. Some of these functions may also report extra + * information, which will be reported by other observer functions. Every `mongo_crypt_v1` * function which reports errors will always update the `Error` code stored in a - * `mongo_csfle_v1_status` object, even upon success. + * `mongo_crypt_v1_status` object, even upon success. * * This function does not report its own failures. */ -MONGO_CSFLE_API int MONGO_API_CALL -mongo_csfle_v1_status_get_error(const mongo_csfle_v1_status* status); +MONGO_CRYPT_API int MONGO_API_CALL +mongo_crypt_v1_status_get_error(const mongo_crypt_v1_status* status); /** - * Gets a descriptive error message from a `mongo_csfle_v1_status` object. + * Gets a descriptive error message from a `mongo_crypt_v1_status` object. * - * For failures where the error is MONGO_CSFLE_V1_ERROR_EXCEPTION, this returns a string + * For failures where the error is MONGO_CRYPT_V1_ERROR_EXCEPTION, this returns a string * representation of the internal C++ exception. * * The function to which the specified status object was passed must not have returned - * MONGO_CSFLE_V1_SUCCESS as its error code. + * MONGO_CRYPT_V1_SUCCESS as its error code. * * The storage for the returned string is associated with the specified status object, and therefore - * it will be deallocated when the status is destroyed using mongo_csfle_v1_status_destroy(). + * it will be deallocated when the status is destroyed using mongo_crypt_v1_status_destroy(). * * This function does not report its own failures. */ -MONGO_CSFLE_API const char* MONGO_API_CALL -mongo_csfle_v1_status_get_explanation(const mongo_csfle_v1_status* status); +MONGO_CRYPT_API const char* MONGO_API_CALL +mongo_crypt_v1_status_get_explanation(const mongo_crypt_v1_status* status); /** - * Gets a status code from a `mongo_csfle_v1_status` object. + * Gets a status code from a `mongo_crypt_v1_status` object. * * Returns a numeric status code associated with the status parameter which indicates a sub-category * of failure. * - * For any status object that does not have MONGO_CSFLE_V1_ERROR_EXCEPTION as its error, the + * For any status object that does not have MONGO_CRYPT_V1_ERROR_EXCEPTION as its error, the * value of this code is unspecified. * * This function does not report its own failures. */ -MONGO_CSFLE_API int MONGO_API_CALL -mongo_csfle_v1_status_get_code(const mongo_csfle_v1_status* status); +MONGO_CRYPT_API int MONGO_API_CALL +mongo_crypt_v1_status_get_code(const mongo_crypt_v1_status* status); /** - * An object which describes the runtime state of the CSFLE Library. + * An object which describes the runtime state of the Mongo Crypt Shared Library. * - * The CSFLE Library uses allocated objects of this type to indicate the present state of - * the library. Some operations which the library provides need access to this object. Further a + * The Mongo Crypt Shared Library uses allocated objects of this type to indicate the present state + * of the library. Some operations which the library provides need access to this object. Further a * construction function and a destruction function for these objects are also provided. No more * than a single object instance of this type may exist at any given time. * - * The use of `mongo_csfle_v1_lib` objects from multiple threads is not thread safe unless all of - * the threads accessing a single `mongo_csfle_v1_lib` object are not destroying this object. If - * a single thread is passing a `mongo_csfle_v1_lib` to its destruction function, then no other - * thread may access the `mongo_csfle_v1_lib` object. + * The use of `mongo_crypt_v1_lib` objects from multiple threads is not thread safe unless all of + * the threads accessing a single `mongo_crypt_v1_lib` object are not destroying this object. If + * a single thread is passing a `mongo_crypt_v1_lib` to its destruction function, then no other + * thread may access the `mongo_crypt_v1_lib` object. */ -typedef struct mongo_csfle_v1_lib mongo_csfle_v1_lib; +typedef struct mongo_crypt_v1_lib mongo_crypt_v1_lib; /** - * Creates a mongo_csfle_v1_lib object, which stores context for the CSFLE library. A - * process should only ever have one mongo_csfle_v1_lib instance. + * Creates a mongo_crypt_v1_lib object, which stores context for the Mongo Crypt Shared library. A + * process should only ever have one mongo_crypt_v1_lib instance. * * On failure, returns NULL and populates the 'status' object if it is not NULL. */ -MONGO_CSFLE_API mongo_csfle_v1_lib* MONGO_API_CALL -mongo_csfle_v1_lib_create(mongo_csfle_v1_status* status); +MONGO_CRYPT_API mongo_crypt_v1_lib* MONGO_API_CALL +mongo_crypt_v1_lib_create(mongo_crypt_v1_status* status); /** - * Tears down the state of this library. Existing mongo_csfle_v1_status objects remain valid. - * Existing mongo_csfle_v1_query_analyzer objects created from this library MUST BE destroyed + * Tears down the state of this library. Existing mongo_crypt_v1_status objects remain valid. + * Existing mongo_crypt_v1_query_analyzer objects created from this library MUST BE destroyed * before destroying the library object. * - * The 'lib' parameter must be a valid mongo_csfle_v1_lib instance and must not be NULL. + * The 'lib' parameter must be a valid mongo_crypt_v1_lib instance and must not be NULL. * - * The 'status' parameter may be NULL, but must be a valid mongo_csfle_v1_status instance if it + * The 'status' parameter may be NULL, but must be a valid mongo_crypt_v1_status instance if it * is not NULL. * - * Returns MONGO_CSFLE_V1_SUCCESS on success. + * Returns MONGO_CRYPT_V1_SUCCESS on success. * - * Returns MONGO_CSFLE_V1_ERROR_LIBRARY_NOT_INITIALIZED and modifies 'status' if - * mongo_csfle_v1_lib_create() has not been called previously. + * Returns MONGO_CRYPT_V1_ERROR_LIBRARY_NOT_INITIALIZED and modifies 'status' if + * mongo_crypt_v1_lib_create() has not been called previously. */ -MONGO_CSFLE_API int MONGO_API_CALL mongo_csfle_v1_lib_destroy(mongo_csfle_v1_lib* lib, - mongo_csfle_v1_status* status); +MONGO_CRYPT_API int MONGO_API_CALL mongo_crypt_v1_lib_destroy(mongo_crypt_v1_lib* lib, + mongo_crypt_v1_status* status); /** @@ -219,42 +219,42 @@ MONGO_CSFLE_API int MONGO_API_CALL mongo_csfle_v1_lib_destroy(mongo_csfle_v1_lib * For example, version 6.2.1 would be encoded as: 0x0006000200010000 * */ -MONGO_CSFLE_API uint64_t MONGO_API_CALL mongo_csfle_v1_get_version(void); +MONGO_CRYPT_API uint64_t MONGO_API_CALL mongo_crypt_v1_get_version(void); /** * Returns a product version as a text string. The string should not be modified or released * * Examples: - * Dev Build/patch: mongo_csfle_v1-rhel80-6.2.1-alpha4-284-g8662e7d - * Release build: mongo_csfle_v1-rhel80-6.2.1 + * Dev Build/patch: mongo_crypt_v1-rhel80-6.2.1-alpha4-284-g8662e7d + * Release build: mongo_crypt_v1-rhel80-6.2.1 */ -MONGO_CSFLE_API const char* MONGO_API_CALL mongo_csfle_v1_get_version_str(void); +MONGO_CRYPT_API const char* MONGO_API_CALL mongo_crypt_v1_get_version_str(void); /** - * A single query analyzer can be used across repeated calls to mongo_csfle_v1_analyze_query. + * A single query analyzer can be used across repeated calls to mongo_crypt_v1_analyze_query. * - * It is not safe to simultaneously invoke mongo_csfle_v1_query_analyzer_create on the same + * It is not safe to simultaneously invoke mongo_crypt_v1_query_analyzer_create on the same * query analyzer from multiple threads * - * It is the client's responsibility to call mongo_csfle_v1_query_analyzer_destroy() to free up + * It is the client's responsibility to call mongo_crypt_v1_query_analyzer_destroy() to free up * resources used by the query analyzer. Once a query analyzer is destroyed, it is not safe to - * call mongo_csfle_v1_analyze_query. + * call mongo_crypt_v1_analyze_query. */ -typedef struct mongo_csfle_v1_query_analyzer mongo_csfle_v1_query_analyzer; +typedef struct mongo_crypt_v1_query_analyzer mongo_crypt_v1_query_analyzer; /** - * Creates a mongo_csfle_v1_query_analyzer object, which stores a parsed collation. + * Creates a mongo_crypt_v1_query_analyzer object, which stores a parsed collation. * - * The 'lib' parameter must be a valid mongo_csfle_v1_lib instance and must not be NULL. + * The 'lib' parameter must be a valid mongo_crypt_v1_lib instance and must not be NULL. * * On failure, it returns NULL and populates the 'status' object if it is not NULL. */ -MONGO_CSFLE_API mongo_csfle_v1_query_analyzer* MONGO_API_CALL -mongo_csfle_v1_query_analyzer_create(mongo_csfle_v1_lib* lib, mongo_csfle_v1_status* status); +MONGO_CRYPT_API mongo_crypt_v1_query_analyzer* MONGO_API_CALL +mongo_crypt_v1_query_analyzer_create(mongo_crypt_v1_lib* lib, mongo_crypt_v1_status* status); /** - * Destroys a valid mongo_csfle_v1_query_analyzer object. + * Destroys a valid mongo_crypt_v1_query_analyzer object. * * This function is not thread safe, and it must not execute concurrently with any other function * that accesses the collation object being destroyed including those that access a matcher, @@ -262,8 +262,8 @@ mongo_csfle_v1_query_analyzer_create(mongo_csfle_v1_lib* lib, mongo_csfle_v1_sta * * This function does not report failures. */ -MONGO_CSFLE_API void MONGO_API_CALL -mongo_csfle_v1_query_analyzer_destroy(mongo_csfle_v1_query_analyzer* analyzer); +MONGO_CRYPT_API void MONGO_API_CALL +mongo_crypt_v1_query_analyzer_destroy(mongo_crypt_v1_query_analyzer* analyzer); /** @@ -283,29 +283,29 @@ mongo_csfle_v1_query_analyzer_destroy(mongo_csfle_v1_query_analyzer* analyzer); * When the analysis is successful, this function returns non-null value which points to a valid * BSON document and updates bson_len with the length of the BSON document */ -MONGO_CSFLE_API uint8_t* MONGO_API_CALL -mongo_csfle_v1_analyze_query(mongo_csfle_v1_query_analyzer* analyzer, +MONGO_CRYPT_API uint8_t* MONGO_API_CALL +mongo_crypt_v1_analyze_query(mongo_crypt_v1_query_analyzer* analyzer, const uint8_t* documentBSON, const char* ns_str, uint32_t ns_len, uint32_t* bson_len, - mongo_csfle_v1_status* status); + mongo_crypt_v1_status* status); /** - * Free the memory of a BSON buffer returned by mongo_csfle_v1_analyze_query(). This function can be + * Free the memory of a BSON buffer returned by mongo_crypt_v1_analyze_query(). This function can be * safely called on a NULL pointer. * * This function can be called at any time to deallocate a BSON buffer and will not invalidate any * library object. */ -MONGO_CSFLE_API void MONGO_API_CALL mongo_csfle_v1_bson_free(uint8_t* bson); +MONGO_CRYPT_API void MONGO_API_CALL mongo_crypt_v1_bson_free(uint8_t* bson); #ifdef __cplusplus } // extern "C" #endif -#undef CSFLE_SUPPORT_API -#pragma pop_macro("CSFLE_SUPPORT_API") +#undef MONGO_CRYPT_SUPPORT_API +#pragma pop_macro("MONGO_CRYPT_SUPPORT_API") #undef MONGO_API_EXPORT #pragma push_macro("MONGO_API_EXPORT") @@ -316,4 +316,4 @@ MONGO_CSFLE_API void MONGO_API_CALL mongo_csfle_v1_bson_free(uint8_t* bson); #undef MONGO_API_CALL #pragma pop_macro("MONGO_API_CALL") -#endif // CSFLE_SUPPORT_H +#endif // MONGO_CRYPT_SUPPORT_H diff --git a/src/mongocrypt-ctx-encrypt.c b/src/mongocrypt-ctx-encrypt.c index 0d6c1b5b5..abaf517c5 100644 --- a/src/mongocrypt-ctx-encrypt.c +++ b/src/mongocrypt-ctx-encrypt.c @@ -955,8 +955,8 @@ _try_run_csfle_marking (mongocrypt_ctx_t *ctx) return true; } - _mcr_csfle_v1_vtable csfle = ctx->crypt->csfle; - mongo_csfle_v1_lib *csfle_lib = ctx->crypt->csfle_lib; + _mongo_crypt_v1_vtable csfle = ctx->crypt->csfle; + mongo_crypt_v1_lib *csfle_lib = ctx->crypt->csfle_lib; BSON_ASSERT (csfle_lib); bool okay = false; @@ -990,10 +990,10 @@ _try_run_csfle_marking (mongocrypt_ctx_t *ctx) } else \ ((void) 0) - mongo_csfle_v1_status *status = csfle.status_create (); + mongo_crypt_v1_status *status = csfle.status_create (); BSON_ASSERT (status); - mongo_csfle_v1_query_analyzer *qa = + mongo_crypt_v1_query_analyzer *qa = csfle.query_analyzer_create (csfle_lib, status); CHECK_CSFLE_ERROR ("query_analyzer_create", fail_qa_create); diff --git a/src/mongocrypt-opts-private.h b/src/mongocrypt-opts-private.h index 41b0528b8..c891bb470 100644 --- a/src/mongocrypt-opts-private.h +++ b/src/mongocrypt-opts-private.h @@ -56,7 +56,7 @@ typedef struct { typedef struct { int configured_providers; /* A bit set of _mongocrypt_kms_provider_t */ - int need_credentials; /* A bit set of _mongocrypt_kms_provider_t */ + int need_credentials; /* A bit set of _mongocrypt_kms_provider_t */ _mongocrypt_opts_kms_provider_local_t local; _mongocrypt_opts_kms_provider_aws_t aws; _mongocrypt_opts_kms_provider_azure_t azure; @@ -74,14 +74,14 @@ typedef struct { mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5; void *sign_ctx; - /// Keep an array of search paths for finding the CSFLE dynamic library + /// Keep an array of search paths for finding the crypt_shared library /// during mongocrypt_init() - int n_cselib_search_paths; - mstr *cselib_search_paths; + int n_crypt_shared_lib_search_paths; + mstr *crypt_shared_lib_search_paths; /// Optionally, a user may override the default search behavior by specifying /// a specifiy path to the library. If this is set, this suppresses the /// search behavior. - mstr csfle_lib_override_path; + mstr crypt_shared_lib_override_path; bool use_need_kms_credentials_state; bool bypass_query_analysis; @@ -98,8 +98,8 @@ _mongocrypt_opts_kms_providers_cleanup ( * being released. */ void _mongocrypt_opts_merge_kms_providers ( - _mongocrypt_opts_kms_providers_t* dest, - const _mongocrypt_opts_kms_providers_t* source); + _mongocrypt_opts_kms_providers_t *dest, + const _mongocrypt_opts_kms_providers_t *source); void _mongocrypt_opts_init (_mongocrypt_opts_t *opts); @@ -150,9 +150,9 @@ _mongocrypt_parse_required_utf8 (const bson_t *bson, * Parse an optional endpoint UTF-8 from BSON. * @dotkey may be a dot separated key like: "a.b.c". * @*out is set to a new _mongocrypt_endpoint_t of the if found, NULL otherwise. - * @*opts may be set to configure endpoint parsing. It is optional and may be NULL. - * Caller must clean up with _mongocrypt_endpoint_destroy (*out). - * Returns true if no error occured. + * @*opts may be set to configure endpoint parsing. It is optional and may be + * NULL. Caller must clean up with _mongocrypt_endpoint_destroy (*out). Returns + * true if no error occured. */ bool _mongocrypt_parse_optional_endpoint (const bson_t *bson, @@ -165,9 +165,9 @@ _mongocrypt_parse_optional_endpoint (const bson_t *bson, * Parse a required endpoint UTF-8 from BSON. * @dotkey may be a dot separated key like: "a.b.c". * @*out is set to a new _mongocrypt_endpoint_t of the if found, NULL otherwise. - * @*opts may be set to configure endpoint parsing. It is optional and may be NULL. - * Caller must clean up with _mongocrypt_endpoint_destroy (*out). - * Returns true if no error occured. + * @*opts may be set to configure endpoint parsing. It is optional and may be + * NULL. Caller must clean up with _mongocrypt_endpoint_destroy (*out). Returns + * true if no error occured. */ bool _mongocrypt_parse_required_endpoint (const bson_t *bson, diff --git a/src/mongocrypt-opts.c b/src/mongocrypt-opts.c index c5cbdf74e..c78a6f833 100644 --- a/src/mongocrypt-opts.c +++ b/src/mongocrypt-opts.c @@ -99,11 +99,11 @@ _mongocrypt_opts_cleanup (_mongocrypt_opts_t *opts) _mongocrypt_buffer_cleanup (&opts->schema_map); _mongocrypt_buffer_cleanup (&opts->encrypted_field_config_map); // Free any lib search paths added by the caller - for (int i = 0; i < opts->n_cselib_search_paths; ++i) { - mstr_free (opts->cselib_search_paths[i]); + for (int i = 0; i < opts->n_crypt_shared_lib_search_paths; ++i) { + mstr_free (opts->crypt_shared_lib_search_paths[i]); } - bson_free (opts->cselib_search_paths); - mstr_free (opts->csfle_lib_override_path); + bson_free (opts->crypt_shared_lib_search_paths); + mstr_free (opts->crypt_shared_lib_override_path); } diff --git a/src/mongocrypt-private.h b/src/mongocrypt-private.h index 3bd50fa22..58484da60 100644 --- a/src/mongocrypt-private.h +++ b/src/mongocrypt-private.h @@ -31,7 +31,7 @@ #include "mongocrypt-crypto-private.h" #include "mongocrypt-cache-oauth-private.h" -#include "mongo_csfle-v1.h" +#include "mongo_crypt-v1.h" #define MONGOCRYPT_GENERIC_ERROR_CODE 1 @@ -72,37 +72,37 @@ _mongocrypt_set_error (mongocrypt_status_t *status, const char *format, ...); -typedef struct _mcr_csfle_v1_vtable { +typedef struct _mongo_crypt_v1_vtable { #define MONGOC_CSFLE_FUNCTIONS_X \ /* status methods */ \ - X_FUNC (status_create, mongo_csfle_v1_status *, void) \ - X_FUNC (status_destroy, void, mongo_csfle_v1_status *status) \ - X_FUNC (status_get_error, int, const mongo_csfle_v1_status *status) \ + X_FUNC (status_create, mongo_crypt_v1_status *, void) \ + X_FUNC (status_destroy, void, mongo_crypt_v1_status *status) \ + X_FUNC (status_get_error, int, const mongo_crypt_v1_status *status) \ X_FUNC (status_get_explanation, \ const char *, \ - const mongo_csfle_v1_status *status) \ - X_FUNC (status_get_code, int, const mongo_csfle_v1_status *status) \ + const mongo_crypt_v1_status *status) \ + X_FUNC (status_get_code, int, const mongo_crypt_v1_status *status) \ /* lib methods */ \ - X_FUNC (lib_create, mongo_csfle_v1_lib *, mongo_csfle_v1_status *status) \ + X_FUNC (lib_create, mongo_crypt_v1_lib *, mongo_crypt_v1_status *status) \ X_FUNC (lib_destroy, \ int, \ - mongo_csfle_v1_lib *lib, \ - mongo_csfle_v1_status *status) \ + mongo_crypt_v1_lib *lib, \ + mongo_crypt_v1_status *status) \ /* query_analyzer methods */ \ X_FUNC (query_analyzer_create, \ - mongo_csfle_v1_query_analyzer *, \ - mongo_csfle_v1_lib *lib, \ - mongo_csfle_v1_status *status) \ + mongo_crypt_v1_query_analyzer *, \ + mongo_crypt_v1_lib *lib, \ + mongo_crypt_v1_status *status) \ X_FUNC ( \ - query_analyzer_destroy, void, mongo_csfle_v1_query_analyzer *analyzer) \ + query_analyzer_destroy, void, mongo_crypt_v1_query_analyzer *analyzer) \ X_FUNC (analyze_query, \ uint8_t *, \ - mongo_csfle_v1_query_analyzer *analyer, \ + mongo_crypt_v1_query_analyzer *analyer, \ const uint8_t *documentBSON, \ const char *ns_str, \ uint32_t ns_len, \ uint32_t *bson_len, \ - mongo_csfle_v1_status *status) \ + mongo_crypt_v1_status *status) \ X_FUNC (get_version, uint64_t, void) \ X_FUNC (get_version_str, const char *, void) \ /* Free bson data created by csfle */ \ @@ -114,7 +114,7 @@ typedef struct _mcr_csfle_v1_vtable { /// Whether the vtable is valid and complete bool okay; -} _mcr_csfle_v1_vtable; +} _mongo_crypt_v1_vtable; struct _mongocrypt_t { bool initialized; @@ -131,9 +131,9 @@ struct _mongocrypt_t { _mongocrypt_cache_oauth_t *cache_oauth_azure; _mongocrypt_cache_oauth_t *cache_oauth_gcp; /// A CSFLE DLL vtable, initialized by mongocrypt_init - _mcr_csfle_v1_vtable csfle; + _mongo_crypt_v1_vtable csfle; /// Pointer to the global csfle_lib object. Should not be freed directly. - mongo_csfle_v1_lib *csfle_lib; + mongo_crypt_v1_lib *csfle_lib; }; typedef enum { diff --git a/src/mongocrypt.c b/src/mongocrypt.c index f039b211d..3998dd886 100644 --- a/src/mongocrypt.c +++ b/src/mongocrypt.c @@ -132,7 +132,7 @@ mongocrypt_new (void) crypt->ctx_counter = 1; crypt->cache_oauth_azure = _mongocrypt_cache_oauth_new (); crypt->cache_oauth_gcp = _mongocrypt_cache_oauth_new (); - crypt->csfle = (_mcr_csfle_v1_vtable){.okay = false}; + crypt->csfle = (_mongo_crypt_v1_vtable){.okay = false}; static mlib_once_flag init_flag = MLIB_ONCE_INITIALIZER; @@ -420,7 +420,7 @@ typedef struct { /// The DLL handle to the opened library. mcr_dll lib; /// A vtable for the functions in the DLL - _mcr_csfle_v1_vtable vtable; + _mongo_crypt_v1_vtable vtable; } _loaded_csfle; /** @@ -454,11 +454,11 @@ _try_load_csfle (const char *filepath, _mongocrypt_log_t *log) filepath); // Construct the library vtable - _mcr_csfle_v1_vtable vtable = {.okay = true}; + _mongo_crypt_v1_vtable vtable = {.okay = true}; #define X_FUNC(Name, RetType, ...) \ { \ /* Symbol names are qualified by the lib name and version: */ \ - const char *symname = "mongo_csfle_v1_" #Name; \ + const char *symname = "mongo_crypt_v1_" #Name; \ vtable.Name = mcr_dll_sym (lib, symname); \ if (vtable.Name == NULL) { \ /* The requested symbol is not present */ \ @@ -541,10 +541,10 @@ _try_find_csfle (mongocrypt_t *crypt) { _loaded_csfle candidate_csfle = {0}; mstr csfle_cand_filepath = MSTR_NULL; - if (crypt->opts.csfle_lib_override_path.data) { + if (crypt->opts.crypt_shared_lib_override_path.data) { // If an override path was specified, skip the library searching behavior csfle_cand_filepath = - mstr_copy (crypt->opts.csfle_lib_override_path.view); + mstr_copy (crypt->opts.crypt_shared_lib_override_path.view); if (_try_replace_dollar_origin (&csfle_cand_filepath, &crypt->log)) { // Succesfully substituted $ORIGIN // Do not allow a plain filename to go through, as that will cause the @@ -557,9 +557,9 @@ _try_find_csfle (mongocrypt_t *crypt) } else { // No override path was specified, so try to find it on the provided // search paths. - for (int i = 0; i < crypt->opts.n_cselib_search_paths; ++i) { - mstr_view cand_dir = crypt->opts.cselib_search_paths[i].view; - mstr_view csfle_filename = mstrv_lit ("mongo_csfle_v1" MCR_DLL_SUFFIX); + for (int i = 0; i < crypt->opts.n_crypt_shared_lib_search_paths; ++i) { + mstr_view cand_dir = crypt->opts.crypt_shared_lib_search_paths[i].view; + mstr_view csfle_filename = mstrv_lit ("mongo_crypt_v1" MCR_DLL_SUFFIX); if (mstr_eq (cand_dir, mstrv_lit ("$SYSTEM"))) { // Caller wants us to search for the library on the system's default // library paths. Pass only the library's filename to cause dll_open @@ -598,9 +598,9 @@ typedef struct csfle_global_lib_state { /// The open library handle: mcr_dll dll; /// vtable for the APIs: - _mcr_csfle_v1_vtable vtable; + _mongo_crypt_v1_vtable vtable; /// The global library state managed by the csfle library: - mongo_csfle_v1_lib *csfle_lib; + mongo_crypt_v1_lib *csfle_lib; } csfle_global_lib_state; csfle_global_lib_state g_csfle_state; @@ -692,10 +692,10 @@ _csfle_drop_global_ref () } if (dropped_last_ref) { - mongo_csfle_v1_status *status = old_state.vtable.status_create (); + mongo_crypt_v1_status *status = old_state.vtable.status_create (); const int destroy_rc = old_state.vtable.lib_destroy (old_state.csfle_lib, status); - if (destroy_rc != MONGO_CSFLE_V1_SUCCESS && status) { + if (destroy_rc != MONGO_CRYPT_V1_SUCCESS && status) { fprintf (stderr, "csfle lib_destroy() failed: %s [Error %d, code %d]\n", old_state.vtable.status_get_explanation (status), @@ -756,7 +756,7 @@ _csfle_replace_or_take_validate_singleton (mongocrypt_t *crypt, // If we have a loaded library, create a csfle_status object to use with // lib_create - mongo_csfle_v1_status *csfle_status = NULL; + mongo_crypt_v1_status *csfle_status = NULL; if (found->okay) { // Create the status. Note that this may fail, so do not assume // csfle_status is non-null. @@ -788,7 +788,7 @@ _csfle_replace_or_take_validate_singleton (mongocrypt_t *crypt, // We have found csfle, and no one else is holding one. Our result will // now become the global result. // Create the single csfle_lib object for the application: - mongo_csfle_v1_lib *csfle_lib = + mongo_crypt_v1_lib *csfle_lib = found->vtable.lib_create (csfle_status); if (csfle_lib == NULL) { // Creation failed: @@ -885,8 +885,8 @@ _wants_csfle (mongocrypt_t *c) if (c->opts.bypass_query_analysis) { return false; } - return c->opts.n_cselib_search_paths != 0 || - c->opts.csfle_lib_override_path.data != NULL; + return c->opts.n_crypt_shared_lib_search_paths != 0 || + c->opts.crypt_shared_lib_override_path.data != NULL; } /** @@ -907,12 +907,13 @@ _try_enable_csfle (mongocrypt_t *crypt) _loaded_csfle found = _try_find_csfle (crypt); - // If a CSFLE override path was specified, but we did not succeed in loading - // CSFLE, that is a hard-error. - if (crypt->opts.csfle_lib_override_path.data && !found.okay) { - CLIENT_ERR ("A CSFLE override path was specified [%s], but we failed to " - "open a dynamic library at that location", - crypt->opts.csfle_lib_override_path.data); + // If a crypt_shared override path was specified, but we did not succeed in + // loading crypt_shared, that is a hard-error. + if (crypt->opts.crypt_shared_lib_override_path.data && !found.okay) { + CLIENT_ERR ( + "A crypt_shared override path was specified [%s], but we failed to " + "open a dynamic library at that location", + crypt->opts.crypt_shared_lib_override_path.data); return false; } @@ -1029,7 +1030,8 @@ mongocrypt_destroy (mongocrypt_t *crypt) const char * -mongocrypt_csfle_version_string (const mongocrypt_t *crypt, uint32_t *len) +mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt, + uint32_t *len) { if (!crypt->csfle.okay) { if (len) { @@ -1045,7 +1047,7 @@ mongocrypt_csfle_version_string (const mongocrypt_t *crypt, uint32_t *len) } uint64_t -mongocrypt_csfle_version (const mongocrypt_t *crypt) +mongocrypt_crypt_shared_lib_version (const mongocrypt_t *crypt) { if (!crypt->csfle.okay) { return 0; @@ -1483,20 +1485,20 @@ _mongocrypt_parse_kms_providers ( void -mongocrypt_setopt_append_csfle_search_path (mongocrypt_t *crypt, - const char *path) +mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt, + const char *path) { // Dup the path string for us to manage mstr pathdup = mstr_copy_cstr (path); // Increase array len - const int new_len = crypt->opts.n_cselib_search_paths + 1; - mstr *const new_array = - bson_realloc (crypt->opts.cselib_search_paths, sizeof (mstr) * new_len); + const int new_len = crypt->opts.n_crypt_shared_lib_search_paths + 1; + mstr *const new_array = bson_realloc ( + crypt->opts.crypt_shared_lib_search_paths, sizeof (mstr) * new_len); // Store the path new_array[new_len - 1] = pathdup; // Write back opts - crypt->opts.cselib_search_paths = new_array; - crypt->opts.n_cselib_search_paths = new_len; + crypt->opts.crypt_shared_lib_search_paths = new_array; + crypt->opts.n_crypt_shared_lib_search_paths = new_len; } @@ -1508,10 +1510,11 @@ mongocrypt_setopt_use_need_kms_credentials_state (mongocrypt_t *crypt) void -mongocrypt_setopt_set_csfle_lib_path_override (mongocrypt_t *crypt, - const char *path) +mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt, + const char *path) { - mstr_assign (&crypt->opts.csfle_lib_override_path, mstr_copy_cstr (path)); + mstr_assign (&crypt->opts.crypt_shared_lib_override_path, + mstr_copy_cstr (path)); } bool diff --git a/src/mongocrypt.h.in b/src/mongocrypt.h.in index 5930453fd..44913a9a4 100644 --- a/src/mongocrypt.h.in +++ b/src/mongocrypt.h.in @@ -452,13 +452,13 @@ mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t *crypt, * then the system's library-search mechanism will never be consulted. * * @note If an absolute path to the library is specified using - * @ref mongocrypt_setopt_set_csfle_lib_path_override, then paths appended here - * will have no effect. + * @ref mongocrypt_setopt_set_crypt_shared_lib_path_override, then paths + * appended here will have no effect. */ MONGOCRYPT_EXPORT void -mongocrypt_setopt_append_csfle_search_path (mongocrypt_t *crypt, - const char *path); +mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t *crypt, + const char *path); /** @@ -476,8 +476,8 @@ mongocrypt_setopt_append_csfle_search_path (mongocrypt_t *crypt, * occur during the call to @ref mongocrypt_init. * * @note If a CSFLE library path override is specified here, then no paths given - * to @ref mongocrypt_setopt_append_csfle_search_path will be consulted when - * opening the CSFLE library. + * to @ref mongocrypt_setopt_append_crypt_shared_lib_search_path will be + * consulted when opening the CSFLE library. * * @note If a path is provided via this API and @ref mongocrypt_init fails to * initialize a valid CSFLE library instance for the path specified, then @@ -485,8 +485,8 @@ mongocrypt_setopt_append_csfle_search_path (mongocrypt_t *crypt, */ MONGOCRYPT_EXPORT void -mongocrypt_setopt_set_csfle_lib_path_override (mongocrypt_t *crypt, - const char *path); +mongocrypt_setopt_set_crypt_shared_lib_path_override (mongocrypt_t *crypt, + const char *path); /** @@ -564,11 +564,12 @@ mongocrypt_destroy (mongocrypt_t *crypt); * @return A nul-terminated string of the dynamically loaded csfle library. * * @note For a numeric value that can be compared against, use - * @ref mongocrypt_csfle_version. + * @ref mongocrypt_crypt_shared_lib_version. */ MONGOCRYPT_EXPORT const char * -mongocrypt_csfle_version_string (const mongocrypt_t *crypt, uint32_t *len); +mongocrypt_crypt_shared_lib_version_string (const mongocrypt_t *crypt, + uint32_t *len); /** @@ -592,7 +593,7 @@ mongocrypt_csfle_version_string (const mongocrypt_t *crypt, uint32_t *len); */ MONGOCRYPT_EXPORT uint64_t -mongocrypt_csfle_version (const mongocrypt_t *crypt); +mongocrypt_crypt_shared_lib_version (const mongocrypt_t *crypt); /** diff --git a/test/csfle-stub.cpp b/test/crypt_shared-stub.cpp similarity index 68% rename from test/csfle-stub.cpp rename to test/crypt_shared-stub.cpp index bdd5d2518..0fac54a8a 100644 --- a/test/csfle-stub.cpp +++ b/test/crypt_shared-stub.cpp @@ -12,9 +12,9 @@ #define EXPORT_API __attribute__ ((visibility ("default"))) #endif -#define CSFLE_SUPPORT_COMPILING +#define MONGO_CRYPT_SUPPORT_COMPILING -#include +#include #include @@ -29,61 +29,61 @@ #define MONGO_API_EXPORT __attribute__ ((used, visibility ("default"))) #endif -struct mongo_csfle_v1_status { +struct mongo_crypt_v1_status { }; -typedef mongo_csfle_v1_status status_t; +typedef mongo_crypt_v1_status status_t; status_t * -mongo_csfle_v1_status_create (void) +mongo_crypt_v1_status_create (void) { return new status_t; } void -mongo_csfle_v1_status_destroy (status_t *st) +mongo_crypt_v1_status_destroy (status_t *st) { delete st; } int -mongo_csfle_v1_status_get_error (const status_t *) +mongo_crypt_v1_status_get_error (const status_t *) { return 0; } const char * -mongo_csfle_v1_status_get_explanation (const status_t *) +mongo_crypt_v1_status_get_explanation (const status_t *) { return "nothing here"; } int -mongo_csfle_v1_status_get_code (const status_t *) +mongo_crypt_v1_status_get_code (const status_t *) { return 0; } -struct mongo_csfle_v1_lib { +struct mongo_crypt_v1_lib { }; -typedef mongo_csfle_v1_lib lib_t; +typedef mongo_crypt_v1_lib lib_t; lib_t * -mongo_csfle_v1_lib_create (status_t *) +mongo_crypt_v1_lib_create (status_t *) { return new lib_t; } int -mongo_csfle_v1_lib_destroy (lib_t *lib, status_t *) +mongo_crypt_v1_lib_destroy (lib_t *lib, status_t *) { delete lib; - return MONGO_CSFLE_V1_SUCCESS; + return MONGO_CRYPT_V1_SUCCESS; } uint64_t -mongo_csfle_v1_get_version (void) +mongo_crypt_v1_get_version (void) { #ifdef UINT64_C return UINT64_C (0x000600020001000); @@ -94,30 +94,30 @@ mongo_csfle_v1_get_version (void) const char * -mongo_csfle_v1_get_version_str (void) +mongo_crypt_v1_get_version_str (void) { - return "stubbed-mongo_csfle"; + return "stubbed-crypt_shared"; } -struct mongo_csfle_v1_query_analyzer { +struct mongo_crypt_v1_query_analyzer { }; -typedef mongo_csfle_v1_query_analyzer query_analyzer_t; +typedef mongo_crypt_v1_query_analyzer query_analyzer_t; query_analyzer_t * -mongo_csfle_v1_query_analyzer_create (lib_t *, status_t *) +mongo_crypt_v1_query_analyzer_create (lib_t *, status_t *) { return new query_analyzer_t; } void -mongo_csfle_v1_query_analyzer_destroy (query_analyzer_t *qa) +mongo_crypt_v1_query_analyzer_destroy (query_analyzer_t *qa) { delete qa; } uint8_t * -mongo_csfle_v1_analyze_query (query_analyzer_t *qa, +mongo_crypt_v1_analyze_query (query_analyzer_t *qa, const uint8_t *doc_bson, const char *ns_str, uint32_t ns_len, @@ -148,7 +148,7 @@ mongo_csfle_v1_analyze_query (query_analyzer_t *qa, } void -mongo_csfle_v1_bson_free (uint8_t *bson) +mongo_crypt_v1_bson_free (uint8_t *bson) { delete[] bson; } diff --git a/test/test-mongocrypt-csfle-lib.c b/test/test-mongocrypt-csfle-lib.c index 7c7dfcbc6..f9742013c 100644 --- a/test/test-mongocrypt-csfle-lib.c +++ b/test/test-mongocrypt-csfle-lib.c @@ -23,8 +23,8 @@ _test_csfle_no_paths (_mongocrypt_tester_t *tester) mongocrypt_t *const crypt = get_test_mongocrypt (tester); ASSERT_OK (mongocrypt_init (crypt), crypt); // No csfle was loaded: - BSON_ASSERT (mongocrypt_csfle_version_string (crypt, NULL) == NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt) == 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt, NULL) == NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt) == 0); mongocrypt_destroy (crypt); } @@ -34,11 +34,12 @@ _test_csfle_not_found (_mongocrypt_tester_t *tester) /// Test that mongocrypt_init succeeds even if the csfle library was not /// found but a search path was specified mongocrypt_t *const crypt = get_test_mongocrypt (tester); - mongocrypt_setopt_append_csfle_search_path (crypt, "/no-such-directory"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, + "/no-such-directory"); ASSERT_OK (mongocrypt_init (crypt), crypt); // No csfle was loaded: - BSON_ASSERT (mongocrypt_csfle_version_string (crypt, NULL) == NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt) == 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt, NULL) == NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt) == 0); mongocrypt_destroy (crypt); } @@ -46,19 +47,21 @@ static void _test_csfle_load (_mongocrypt_tester_t *tester) { mongocrypt_t *const crypt = get_test_mongocrypt (tester); - mongocrypt_setopt_append_csfle_search_path (crypt, "no-such-directory"); - mongocrypt_setopt_append_csfle_search_path (crypt, "$ORIGIN"); - mongocrypt_setopt_append_csfle_search_path (crypt, "another-no-such-dir"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, + "no-such-directory"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, "$ORIGIN"); + mongocrypt_setopt_append_crypt_shared_lib_search_path ( + crypt, "another-no-such-dir"); ASSERT_OK (mongocrypt_init (crypt), crypt); // csfle WAS loaded: - BSON_ASSERT (mongocrypt_csfle_version_string (crypt, NULL) != NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt) != 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt, NULL) != NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt) != 0); mstr_view version = - mstrv_view_cstr (mongocrypt_csfle_version_string (crypt, NULL)); - if (TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { - MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_csfle_v1-")); + mstrv_view_cstr (mongocrypt_crypt_shared_lib_version_string (crypt, NULL)); + if (TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { + MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_crypt_v1-")); } else { - MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-mongo_csfle")); + MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-crypt_shared")); } mongocrypt_destroy (crypt); } @@ -67,32 +70,32 @@ static void _test_csfle_load_twice (_mongocrypt_tester_t *tester) { mongocrypt_t *const crypt1 = get_test_mongocrypt (tester); - mongocrypt_setopt_append_csfle_search_path (crypt1, "$ORIGIN"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt1, "$ORIGIN"); ASSERT_OK (mongocrypt_init (crypt1), crypt1); - BSON_ASSERT (mongocrypt_csfle_version_string (crypt1, NULL) != NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt1) != 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt1, NULL) != NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt1) != 0); // Make another one: mongocrypt_t *const crypt2 = get_test_mongocrypt (tester); - mongocrypt_setopt_append_csfle_search_path (crypt2, "$ORIGIN"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt2, "$ORIGIN"); ASSERT_OK (mongocrypt_init (crypt2), crypt2); // csfle was loaded again: - BSON_ASSERT (mongocrypt_csfle_version_string (crypt2, NULL) != NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt2) != 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt2, NULL) != NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt2) != 0); mstr_view version = - mstrv_view_cstr (mongocrypt_csfle_version_string (crypt1, NULL)); - if (TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { - MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_csfle_v1-")); + mstrv_view_cstr (mongocrypt_crypt_shared_lib_version_string (crypt1, NULL)); + if (TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { + MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_crypt_v1-")); } else { - MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-mongo_csfle")); + MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-crypt_shared")); } - version = mstrv_view_cstr (mongocrypt_csfle_version_string (crypt2, NULL)); - if (TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { - MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_csfle_v1-")); + version = mstrv_view_cstr (mongocrypt_crypt_shared_lib_version_string (crypt2, NULL)); + if (TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { + MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_crypt_v1-")); } else { - MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-mongo_csfle")); + MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-crypt_shared")); } mongocrypt_destroy (crypt1); @@ -103,26 +106,26 @@ static void _test_csfle_load_twice_fail (_mongocrypt_tester_t *tester) { mongocrypt_t *const crypt1 = get_test_mongocrypt (tester); - mongocrypt_setopt_append_csfle_search_path (crypt1, "$ORIGIN"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt1, "$ORIGIN"); ASSERT_OK (mongocrypt_init (crypt1), crypt1); - BSON_ASSERT (mongocrypt_csfle_version_string (crypt1, NULL) != NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt1) != 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt1, NULL) != NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt1) != 0); // Make another one, but finding a different dynamic library: mongocrypt_t *const crypt2 = get_test_mongocrypt (tester); - mongocrypt_setopt_set_csfle_lib_path_override ( - crypt2, "$ORIGIN/stubbed-csfle-2.dll"); + mongocrypt_setopt_set_crypt_shared_lib_path_override ( + crypt2, "$ORIGIN/stubbed-crypt_shared-2.dll"); // Loading a second different library is an error: ASSERT_FAILS (mongocrypt_init (crypt2), crypt2, "attempted to load a second CSFLE library"); mstr_view version = - mstrv_view_cstr (mongocrypt_csfle_version_string (crypt1, NULL)); - if (TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { - MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_csfle_v1-")); + mstrv_view_cstr (mongocrypt_crypt_shared_lib_version_string (crypt1, NULL)); + if (TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { + MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_crypt_v1-")); } else { - MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-mongo_csfle")); + MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-crypt_shared")); } mongocrypt_destroy (crypt1); @@ -134,18 +137,18 @@ _test_csfle_path_override_okay (_mongocrypt_tester_t *tester) { mongocrypt_t *const crypt = get_test_mongocrypt (tester); // Set to the absolute path to the DLL we use for testing: - mongocrypt_setopt_set_csfle_lib_path_override ( - crypt, "$ORIGIN/mongo_csfle_v1" MCR_DLL_SUFFIX); + mongocrypt_setopt_set_crypt_shared_lib_path_override ( + crypt, "$ORIGIN/mongo_crypt_v1" MCR_DLL_SUFFIX); ASSERT_OK (mongocrypt_init (crypt), crypt); // csfle WAS loaded: - BSON_ASSERT (mongocrypt_csfle_version_string (crypt, NULL) != NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt) != 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt, NULL) != NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt) != 0); mstr_view version = - mstrv_view_cstr (mongocrypt_csfle_version_string (crypt, NULL)); - if (TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { - MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_csfle_v1-")); + mstrv_view_cstr (mongocrypt_crypt_shared_lib_version_string (crypt, NULL)); + if (TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { + MSTR_ASSERT (true, version, starts_with, mstrv_lit ("mongo_crypt_v1-")); } else { - MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-mongo_csfle")); + MSTR_ASSERT (true, version, eq, mstrv_lit ("stubbed-crypt_shared")); } mongocrypt_destroy (crypt); } @@ -155,16 +158,16 @@ _test_csfle_path_override_fail (_mongocrypt_tester_t *tester) { mongocrypt_t *const crypt = get_test_mongocrypt (tester); // Set to the absolute path to a file that does not exist - mongocrypt_setopt_set_csfle_lib_path_override ( - crypt, "/no-such-file-or-directory/mongo_csfle_v1" MCR_DLL_SUFFIX); + mongocrypt_setopt_set_crypt_shared_lib_path_override ( + crypt, "/no-such-file-or-directory/mongo_crypt_v1" MCR_DLL_SUFFIX); // This *would* succeed, but we don't use the search paths if an absolute // override was specified: - mongocrypt_setopt_append_csfle_search_path (crypt, "$ORIGIN"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, "$ORIGIN"); ASSERT_FAILS (mongocrypt_init (crypt), crypt, "but we failed to open a dynamic library at that location"); - BSON_ASSERT (mongocrypt_csfle_version_string (crypt, NULL) == NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt) == 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt, NULL) == NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt) == 0); mongocrypt_destroy (crypt); } @@ -181,11 +184,11 @@ static void _test_csfle_not_loaded_with_bypassqueryanalysis (_mongocrypt_tester_t *tester) { mongocrypt_t *const crypt = get_test_mongocrypt (tester); - mongocrypt_setopt_append_csfle_search_path (crypt, "$ORIGIN"); + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, "$ORIGIN"); mongocrypt_setopt_bypass_query_analysis (crypt); ASSERT_OK (mongocrypt_init (crypt), crypt); - BSON_ASSERT (mongocrypt_csfle_version_string (crypt, NULL) == NULL); - BSON_ASSERT (mongocrypt_csfle_version (crypt) == 0); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version_string (crypt, NULL) == NULL); + BSON_ASSERT (mongocrypt_crypt_shared_lib_version (crypt) == 0); mongocrypt_destroy (crypt); } diff --git a/test/test-mongocrypt-ctx-encrypt.c b/test/test-mongocrypt-ctx-encrypt.c index a4205a049..3f622be7b 100644 --- a/test/test-mongocrypt-ctx-encrypt.c +++ b/test/test-mongocrypt-ctx-encrypt.c @@ -641,7 +641,7 @@ _test_encrypt_need_markings (_mongocrypt_tester_t *tester) static void _test_encrypt_csfle_no_needs_markings (_mongocrypt_tester_t *tester) { - if (!TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { + if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { fputs ("No 'real' csfle library is available. The " "_test_encrypt_csfle_no_needs_markings test is a no-op.", stderr); @@ -650,7 +650,7 @@ _test_encrypt_csfle_no_needs_markings (_mongocrypt_tester_t *tester) /* Success. */ mongocrypt_t *crypt = - _mongocrypt_tester_mongocrypt (TESTER_MONGOCRYPT_WITH_CSFLE_LIB); + _mongocrypt_tester_mongocrypt (TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB); mongocrypt_ctx_t *ctx = mongocrypt_ctx_new (crypt); ASSERT_OK (mongocrypt_ctx_encrypt_init ( ctx, "test", -1, TEST_FILE ("./test/example/cmd.json")), @@ -3447,7 +3447,7 @@ _test_encrypt_fle2_explain_with_mongocryptd (_mongocrypt_tester_t *tester) static void _test_encrypt_fle2_explain_with_csfle (_mongocrypt_tester_t *tester) { - if (!TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { + if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { fputs ("No 'real' csfle library is available. The " "_test_encrypt_fle2_explain_with_csfle test is a no-op.", stderr); @@ -3457,8 +3457,8 @@ _test_encrypt_fle2_explain_with_csfle (_mongocrypt_tester_t *tester) /* Test with an encrypted value. Otherwise 'encryptionInformation' is not * appended. */ { - mongocrypt_t *crypt = - _mongocrypt_tester_mongocrypt (TESTER_MONGOCRYPT_WITH_CSFLE_LIB); + mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt ( + TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB); mongocrypt_ctx_t *ctx = mongocrypt_ctx_new (crypt); ASSERT_OK (mongocrypt_ctx_encrypt_init ( @@ -3576,7 +3576,7 @@ _test_encrypt_fle1_explain_with_mongocryptd (_mongocrypt_tester_t *tester) static void _test_encrypt_fle1_explain_with_csfle (_mongocrypt_tester_t *tester) { - if (!TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { + if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { fputs ("No 'real' csfle library is available. The " "_test_encrypt_fle1_explain_with_csfle test is a no-op.", stderr); @@ -3584,8 +3584,8 @@ _test_encrypt_fle1_explain_with_csfle (_mongocrypt_tester_t *tester) } { - mongocrypt_t *crypt = - _mongocrypt_tester_mongocrypt (TESTER_MONGOCRYPT_WITH_CSFLE_LIB); + mongocrypt_t *crypt = _mongocrypt_tester_mongocrypt ( + TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB); mongocrypt_ctx_t *ctx = mongocrypt_ctx_new (crypt); ASSERT_OK (mongocrypt_ctx_encrypt_init ( @@ -4108,7 +4108,7 @@ _test_fle1_create_old_mongocryptd (_mongocrypt_tester_t *tester) static void _test_fle1_create_with_csfle (_mongocrypt_tester_t *tester) { - if (!TEST_MONGOCRYPT_HAVE_REAL_CSFLE) { + if (!TEST_MONGOCRYPT_HAVE_REAL_CRYPT_SHARED_LIB) { fputs ("No 'real' csfle library is available. The " "_test_fle1_create_with_csfle test is a no-op.", stderr); @@ -4116,7 +4116,7 @@ _test_fle1_create_with_csfle (_mongocrypt_tester_t *tester) } mongocrypt_t *crypt = - _mongocrypt_tester_mongocrypt (TESTER_MONGOCRYPT_WITH_CSFLE_LIB); + _mongocrypt_tester_mongocrypt (TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB); mongocrypt_ctx_t *ctx = mongocrypt_ctx_new (crypt); ASSERT_OK (mongocrypt_ctx_encrypt_init ( diff --git a/test/test-mongocrypt.c b/test/test-mongocrypt.c index 8eb12977a..b7598c9f5 100644 --- a/test/test-mongocrypt.c +++ b/test/test-mongocrypt.c @@ -545,14 +545,15 @@ _mongocrypt_tester_mongocrypt (tester_mongocrypt_flags flags) ASSERT_OK (mongocrypt_setopt_kms_providers (crypt, bin), crypt); bson_destroy (kms_providers); mongocrypt_binary_destroy (bin); - if (flags & TESTER_MONGOCRYPT_WITH_CSFLE_LIB) { - mongocrypt_setopt_append_csfle_search_path (crypt, "$ORIGIN"); + if (flags & TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB) { + mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, "$ORIGIN"); } ASSERT_OK (mongocrypt_init (crypt), crypt); - if (flags & TESTER_MONGOCRYPT_WITH_CSFLE_LIB) { - if (mongocrypt_csfle_version (crypt) == 0) { - BSON_ASSERT (!"tester mongocrypt requested WITH_CSFLE_LIB, but not " - "csfle library was loaded by mongocrypt_init"); + if (flags & TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB) { + if (mongocrypt_crypt_shared_lib_version (crypt) == 0) { + BSON_ASSERT ( + !"tester mongocrypt requested WITH_CRYPT_SHARED_LIB, but no " + "crypt_shared library was loaded by mongocrypt_init"); } } return crypt; diff --git a/test/test-mongocrypt.h b/test/test-mongocrypt.h index b3c6f4748..60e100e1b 100644 --- a/test/test-mongocrypt.h +++ b/test/test-mongocrypt.h @@ -36,9 +36,10 @@ typedef void (*_mongocrypt_test_fn) (struct __mongocrypt_tester_t *tester); typedef enum tester_mongocrypt_flags { /// Default settings for creating a mongocrypt_t for testing TESTER_MONGOCRYPT_DEFAULT = 0, - /// Create a mongocrypt_t that has the csfle library loaded. A csfle library - /// must be present in the same directory as the test executable. - TESTER_MONGOCRYPT_WITH_CSFLE_LIB = 1 << 0, + /// Create a mongocrypt_t that has the crypt_shared library loaded. A + /// crypt_shared library must be present in the same directory as the test + /// executable. + TESTER_MONGOCRYPT_WITH_CRYPT_SHARED_LIB = 1 << 0, } tester_mongocrypt_flags; /* Arbitrary max of 2048 instances of temporary test data. Increase as needed.