Skip to content

Commit db7e894

Browse files
vector-of-boolkevinAlbseramongodb
authored
[CDRIVER-4400] Rename references of "csfle" to "crypt_shared" (#1022)
* Rename references of "csfle" to "crypt_shared" * use crypt_shared 6.0.0-rc8 * test with libmongocrypt master * CDRIVER-4397 update fle2 find payloads * update download-mongodb.sh to use 6.0.0-rc8 * add TODO comments to pin to 1.5.0-rc0 * fix check for crypt_shared availability * remove unused compile definition Co-authored-by: Kevin Albertson <[email protected]> Co-authored-by: Ezra Chung <[email protected]>
1 parent a40659c commit db7e894

20 files changed

+119
-100
lines changed

.evergreen/compile-unix.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ fi
203203

204204
CONFIGURE_FLAGS="$CONFIGURE_FLAGS -DMONGO_SANITIZE=$SANITIZE"
205205

206-
if ! python3 build/mongodl.py --test -C csfle -V 6.0.0-rc4 -o . > /dev/null; then
207-
echo "No csfle detected for this platform. Disabling MONGOC_TEST_USE_CSFLE."
208-
CONFIGURE_FLAGS="$CONFIGURE_FLAGS -DMONGOC_TEST_USE_CSFLE=OFF"
206+
if ! python3 build/mongodl.py --test -C crypt_shared -V 6.0.0-rc8 -o . > /dev/null; then
207+
echo "No crypt_shared detected for this platform. Disabling MONGOC_TEST_USE_CRYPT_SHARED."
208+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS -DMONGOC_TEST_USE_CRYPT_SHARED=OFF"
209209
fi
210210

211211
CONFIGURE_FLAGS="$CONFIGURE_FLAGS $EXTRA_CONFIGURE_FLAGS"
@@ -227,7 +227,8 @@ pkg-config --modversion libssl || true
227227

228228
if [ "$COMPILE_LIBMONGOCRYPT" = "ON" ]; then
229229
# Build libmongocrypt, using the previously fetched installed source.
230-
git clone https://github.com/mongodb/libmongocrypt --branch 1.5.0-alpha2
230+
# TODO (CDRIVER-4397): add "--branch 1.5.0-rc0" in git clone once libmongocrypt 1.5.0-rc0 is released.
231+
git clone https://github.com/mongodb/libmongocrypt
231232
mkdir libmongocrypt/cmake-build
232233
cd libmongocrypt/cmake-build
233234
$CMAKE -DENABLE_SHARED_BSON=ON -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" ../

.evergreen/compile-windows.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ fi
115115

116116
if [ "$COMPILE_LIBMONGOCRYPT" = "ON" ]; then
117117
# Build libmongocrypt, using the previously fetched installed source.
118-
git clone https://github.com/mongodb/libmongocrypt --branch 1.5.0-alpha2
118+
# TODO (CDRIVER-4397): add "--branch 1.5.0-rc0" in git clone once libmongocrypt 1.5.0-rc0 is released.
119+
git clone https://github.com/mongodb/libmongocrypt
119120
mkdir libmongocrypt/cmake-build
120121
cd libmongocrypt/cmake-build
121122
"$CMAKE" -G "$CC" "-DCMAKE_PREFIX_PATH=${INSTALL_DIR}/lib/cmake" -DENABLE_SHARED_BSON=ON -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" ../

.evergreen/download-mongodb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ get_mongodb_download_url_for ()
5454
# Set VERSION_RAPID to the latest rapid release each quarter.
5555
VERSION_RAPID="5.3.1"
5656
VERSION_60_LATEST="v6.0-latest"
57-
VERSION_60="6.0.0-rc5"
57+
VERSION_60="6.0.0-rc8"
5858
VERSION_50="5.0.8"
5959
VERSION_44="4.4.13"
6060
VERSION_42="4.2.19"

.evergreen/run-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ if [ "$CLIENT_SIDE_ENCRYPTION" = "on" ]; then
111111
wait_for_kms_server 5698
112112
echo "Waiting for mock KMS servers to start... done."
113113
if ! test -d /cygdrive/c; then
114-
# We have trouble with this test on Windows. only set csflePath on other platforms
115-
export MONGOC_TEST_CSFLE_PATH="$(find . -wholename '*src/libmongoc/mongo_csfle_v1.*' -and -regex '.*\(.dll\|.dylib\|.so\)' | head -n1)"
116-
echo "Setting env csflePath: [$MONGOC_TEST_CSFLE_PATH]"
114+
# We have trouble with this test on Windows. only set cryptSharedLibPath on other platforms
115+
export MONGOC_TEST_CRYPT_SHARED_LIB_PATH="$(find . -wholename '*src/libmongoc/mongo_crypt_v1.*' -and -regex '.*\(.dll\|.dylib\|.so\)' | head -n1)"
116+
echo "Setting env cryptSharedLibPath: [$MONGOC_TEST_CRYPT_SHARED_LIB_PATH]"
117117
fi
118118
fi
119119

.evergreen/skip-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@
8686
/sessions/unified/snapshot-sessions/"countDocuments operation with snapshot" # (CDRIVER-4355) error: checking expectResult: { "$numberInt" : "2" }
8787
/load_balancers/non-lb-connection-establishment/"operations against non-load balanced clusters fail if URI contains loadBalanced=true" # (CDRIVER-4356) error: expected error to contain "Driver attempted to initialize in load balancing mode, but the server does not support this mode", but got: "BSON field 'hello.loadBalanced' is an unknown field."
8888

89-
/client_side_encryption/bypass_spawning_mongocryptd/mongocryptdBypassSpawn # Fails if csfle is visible
89+
/client_side_encryption/bypass_spawning_mongocryptd/mongocryptdBypassSpawn # Fails if crypt_shared is visible

src/libmongoc/CMakeLists.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -857,36 +857,36 @@ if (ENABLE_SHM_COUNTERS STREQUAL "ON")
857857
endif ()
858858

859859
cmake_dependent_option (
860-
MONGOC_TEST_USE_CSFLE "If TRUE, download and use a csfle dynamic library for client-side-encryption testing. Otherwise will rely on mongocryptd"
860+
MONGOC_TEST_USE_CRYPT_SHARED "If TRUE, download and use a crypt_shared library for client-side-encryption testing. Otherwise will rely on mongocryptd"
861861
TRUE ENABLE_TESTS FALSE
862862
)
863863

864-
if (MONGOC_TEST_USE_CSFLE)
864+
if (MONGOC_TEST_USE_CRYPT_SHARED)
865865
find_program (_PYTHON3_EXE NAMES python3 py python)
866866
mark_as_advanced (_PYTHON3_EXE)
867867
if (NOT _PYTHON3_EXE)
868868
message (SEND_ERROR
869-
"MONGOC_TEST_USE_CSFLE is enabled, but we were unable to find a Python 3 interpreter to use mongodl.py. "
870-
"Install a Python 3 or set MONGOC_TEST_USE_CSFLE to FALSE"
869+
"MONGOC_TEST_USE_CRYPT_SHARED is enabled, but we were unable to find a Python 3 interpreter to use mongodl.py. "
870+
"Install a Python 3 or set MONGOC_TEST_USE_CRYPT_SHARED to FALSE"
871871
)
872872
endif ()
873873

874-
get_filename_component (csfle_dest "${CMAKE_CURRENT_BINARY_DIR}/mongo_csfle_v1${CMAKE_SHARED_LIBRARY_SUFFIX}" ABSOLUTE)
875-
# If updating the "--version" for csfle, update the version in compile-unix.sh to match.
874+
get_filename_component (crypt_shared_dest "${CMAKE_CURRENT_BINARY_DIR}/mongo_crypt_v1${CMAKE_SHARED_LIBRARY_SUFFIX}" ABSOLUTE)
875+
# If updating the "--version" for crypt_shared, update the version in compile-unix.sh to match.
876876
add_custom_command (
877-
OUTPUT "${csfle_dest}"
877+
OUTPUT "${crypt_shared_dest}"
878878
COMMAND
879879
"${_PYTHON3_EXE}" -u "${mongo-c-driver_SOURCE_DIR}/build/mongodl.py"
880-
--component csfle
881-
--version 6.0.0-rc5
880+
--component crypt_shared
881+
--version 6.0.0-rc8
882882
--edition enterprise
883883
--out "${CMAKE_CURRENT_BINARY_DIR}"
884-
--only "**/mongo_csfle_v1.*"
884+
--only "**/mongo_crypt_v1.*"
885885
--strip-path-components 1
886-
COMMENT "Downloading csfle"
886+
COMMENT "Downloading crypt_shared"
887887
VERBATIM
888888
)
889-
add_custom_target (get-csfle ALL DEPENDS "${csfle_dest}")
889+
add_custom_target (get-crypt_shared ALL DEPENDS "${crypt_shared_dest}")
890890
endif ()
891891

892892
function (mongoc_add_test test use_shared)
@@ -1091,10 +1091,6 @@ mongoc_add_test (test-libmongoc FALSE ${test-libmongoc-sources})
10911091
mongoc_add_test (test-mongoc-gssapi FALSE ${PROJECT_SOURCE_DIR}/tests/test-mongoc-gssapi.c)
10921092
mongoc_add_test (test-mongoc-cache FALSE ${PROJECT_SOURCE_DIR}/tests/test-mongoc-cache.c)
10931093

1094-
if (TARGET get-csfle AND TARGET test-libmongoc)
1095-
target_compile_definitions (test-libmongoc PRIVATE "TESTING_CSFLE_OVERRIDE_PATH=\"./mongo_csfle_v1${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
1096-
endif ()
1097-
10981094
if (ENABLE_TESTS)
10991095
# "make test" doesn't compile tests, so we create "make check" which compiles
11001096
# and runs tests: https://gitlab.kitware.com/cmake/cmake/issues/8774

src/libmongoc/doc/mongoc_auto_encryption_opts_set_bypass_query_analysis.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ Parameters
2121

2222

2323
``bypass_query_analysis`` disables automatic analysis of outgoing commands.
24-
``bypass_query_analysis`` is useful for encrypting indexed fields without the ``csfle`` shared library or ``mongocryptd`` process.
25-
Set ``bypass_query_analysis`` to true to use explicit encryption on indexed fields.
24+
``bypass_query_analysis`` is useful for encrypting indexed fields without the
25+
``crypt_shared`` library or ``mongocryptd`` process. Set
26+
``bypass_query_analysis`` to true to use explicit encryption on indexed fields.
2627

2728
.. seealso::
2829

src/libmongoc/doc/mongoc_auto_encryption_opts_set_extra.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ Parameters
2525
* ``mongocryptdBypassSpawn`` set to true to prevent the driver from spawning the mongocryptd process (default behavior is to spawn).
2626
* ``mongocryptdSpawnPath`` set to a path (with trailing slash) to search for mongocryptd (defaults to empty string and uses default system paths).
2727
* ``mongocryptdSpawnArgs`` set to an array of string arguments to pass to ``mongocryptd`` when spawning (defaults to ``[ "--idleShutdownTimeoutSecs=60" ]``).
28-
* ``csflePath`` - Set a filepath string referring to a ``csfle`` dynamic library
29-
file. Unset by default.
30-
31-
* If not set (the default), ``libmongocrypt`` will attempt to load ``csfle``
32-
using the host system's default dynamic-library-search system.
33-
* If set, the given path should identify the ``csfle`` dynamic library file
34-
itself, not the directory that contains it.
28+
* ``cryptSharedLibPath`` - Set a filepath string referring to a ``crypt_shared``
29+
library file. Unset by default.
30+
31+
* If not set (the default), ``libmongocrypt`` will attempt to load
32+
``crypt_shared`` using the host system's default dynamic-library-search
33+
system.
34+
* If set, the given path should identify the ``crypt_shared`` dynamic library
35+
file itself, not the directory that contains it.
3536
* If the given path is a relative path and the first path component is
3637
``$ORIGIN``, the ``$ORIGIN`` component will be replaced with the absolute
3738
path to the directory containing the ``libmongocrypt`` library in use by the
@@ -41,17 +42,17 @@ Parameters
4142

4243
* If the given path is a relative path, the path will be resolved relative to
4344
the working directory of the operating system process.
44-
* If this option is set and ``libmongocrypt`` fails to load ``csfle`` from the
45+
* If this option is set and ``libmongocrypt`` fails to load ``crypt_shared`` from the
4546
given filepath, ``libmongocrypt`` will fail to initialize and will not
46-
attempt to search for ``csfle`` in any other locations.
47+
attempt to search for ``crypt_shared`` in any other locations.
4748

48-
* ``csfleRequired`` - If set to ``true``, and ``libmongocrypt`` fails to load a
49-
``csfle`` dynamic library, initialization of auto-encryption will fail
50-
immediately and will not attempt to spawn ``mongocryptd``.
49+
* ``cryptSharedLibRequired`` - If set to ``true``, and ``libmongocrypt`` fails
50+
to load a ``crypt_shared`` library, initialization of auto-encryption will
51+
fail immediately and will not attempt to spawn ``mongocryptd``.
5152

52-
If set to ``false`` (the default), ``csflePath`` is not set, *and*
53-
``libmongocrypt`` fails to load ``csfle``, then ``libmongocrypt`` will proceed
54-
without ``csfle`` and fall back to using ``mongocryptd``.
53+
If set to ``false`` (the default), ``cryptSharedLibPath`` is not set, *and*
54+
``libmongocrypt`` fails to load ``crypt_shared``, then ``libmongocrypt`` will
55+
proceed without ``crypt_shared`` and fall back to using ``mongocryptd``.
5556

5657
For more information, see the `Client-Side Encryption specification <https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#extraoptions>`_.
5758

src/libmongoc/src/mongoc/mongoc-client-side-encryption.c

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,29 +1423,32 @@ _parse_extra (const bson_t *extra,
14231423
}
14241424
}
14251425

1426-
if (bson_iter_init_find (&iter, extra, "csflePath")) {
1426+
if (bson_iter_init_find (&iter, extra, "cryptSharedLibPath")) {
14271427
if (!BSON_ITER_HOLDS_UTF8 (&iter)) {
14281428
bson_set_error (error,
14291429
MONGOC_ERROR_CLIENT,
14301430
MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG,
1431-
"Expected a string for 'csflePath'");
1431+
"Expected a string for 'cryptSharedLibPath'");
14321432
GOTO (fail);
14331433
}
14341434
size_t len;
14351435
const char *ptr = bson_iter_utf8_unsafe (&iter, &len);
1436-
bson_free (topology->csfle_override_path);
1437-
topology->csfle_override_path = bson_strdup (ptr);
1436+
bson_free (topology->clientSideEncryption.autoOptions.extraOptions
1437+
.cryptSharedLibPath);
1438+
topology->clientSideEncryption.autoOptions.extraOptions
1439+
.cryptSharedLibPath = bson_strdup (ptr);
14381440
}
14391441

1440-
if (bson_iter_init_find (&iter, extra, "csfleRequired")) {
1442+
if (bson_iter_init_find (&iter, extra, "cryptSharedLibRequired")) {
14411443
if (!BSON_ITER_HOLDS_BOOL (&iter)) {
14421444
bson_set_error (error,
14431445
MONGOC_ERROR_CLIENT,
14441446
MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG,
1445-
"Expected a bool for 'csfleRequired'");
1447+
"Expected a bool for 'cryptSharedLibRequired'");
14461448
GOTO (fail);
14471449
}
1448-
topology->csfle_required = bson_iter_bool_unsafe (&iter);
1450+
topology->clientSideEncryption.autoOptions.extraOptions
1451+
.cryptSharedLibRequired = bson_iter_bool_unsafe (&iter);
14491452
}
14501453
}
14511454

@@ -1552,8 +1555,10 @@ _mongoc_cse_client_enable_auto_encryption (mongoc_client_t *client,
15521555
opts->schema_map,
15531556
opts->encrypted_fields_map,
15541557
opts->tls_opts,
1555-
client->topology->csfle_override_path,
1556-
client->topology->csfle_required,
1558+
client->topology->clientSideEncryption.autoOptions
1559+
.extraOptions.cryptSharedLibPath,
1560+
client->topology->clientSideEncryption.autoOptions
1561+
.extraOptions.cryptSharedLibRequired,
15571562
opts->bypass_auto_encryption,
15581563
opts->bypass_query_analysis,
15591564
error);
@@ -1706,15 +1711,18 @@ _mongoc_cse_client_pool_enable_auto_encryption (
17061711
GOTO (fail);
17071712
}
17081713

1709-
topology->crypt = _mongoc_crypt_new (opts->kms_providers,
1710-
opts->schema_map,
1711-
opts->encrypted_fields_map,
1712-
opts->tls_opts,
1713-
topology->csfle_override_path,
1714-
topology->csfle_required,
1715-
opts->bypass_auto_encryption,
1716-
opts->bypass_query_analysis,
1717-
error);
1714+
topology->crypt =
1715+
_mongoc_crypt_new (opts->kms_providers,
1716+
opts->schema_map,
1717+
opts->encrypted_fields_map,
1718+
opts->tls_opts,
1719+
topology->clientSideEncryption.autoOptions.extraOptions
1720+
.cryptSharedLibPath,
1721+
topology->clientSideEncryption.autoOptions.extraOptions
1722+
.cryptSharedLibRequired,
1723+
opts->bypass_auto_encryption,
1724+
opts->bypass_query_analysis,
1725+
error);
17181726
if (!topology->crypt) {
17191727
GOTO (fail);
17201728
}
@@ -1816,8 +1824,8 @@ mongoc_client_encryption_new (mongoc_client_encryption_opts_t *opts,
18161824
NULL /* schema_map */,
18171825
NULL /* encrypted_fields_map */,
18181826
opts->tls_opts,
1819-
NULL /* No csfle path */,
1820-
false /* csfle not requried */,
1827+
NULL /* No crypt_shared path */,
1828+
false /* crypt_shared not requried */,
18211829
true, /* bypassAutoEncryption (We are explicit) */
18221830
false /* bypass_query_analysis. Not applicable. */,
18231831
error);

src/libmongoc/src/mongoc/mongoc-crypt-private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ _mongoc_crypt_new (const bson_t *kms_providers,
3838
const bson_t *schema_map,
3939
const bson_t *encrypted_fields_map,
4040
const bson_t *tls_opts,
41-
const char *csfle_override_path,
42-
bool csfle_required,
41+
const char *crypt_shared_lib_path,
42+
bool crypt_shared_lib_required,
4343
bool bypass_auto_encryption,
4444
bool bypass_query_analysis,
4545
bson_error_t *error);

0 commit comments

Comments
 (0)