Skip to content

Commit ac7fc24

Browse files
authored
RUST-1843 Driver fixes for breaking changes in libmongocrypt 1.10.0 (#1131)
1 parent 71956b4 commit ac7fc24

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

.evergreen/MSRV-Cargo.toml.diff

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
168c168
1+
112a113
2+
> url = "=2.5.0"
3+
167c168
24
< time = "0.3.9"
35
---
46
> time = "=0.3.9"

deny.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ allow = [
7777
"BSD-3-Clause",
7878
"MPL-2.0",
7979
"Unicode-DFS-2016",
80+
"Unicode-3.0",
8081
]
8182
# List of explicitly disallowed licenses
8283
# See https://spdx.org/licenses/ for list of possible licenses

src/action/csfle/encrypt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ impl ClientEncryption {
5151
client_enc: self,
5252
mode: Expression { value: expression },
5353
key: key.into(),
54+
#[allow(deprecated)]
5455
algorithm: Algorithm::RangePreview,
5556
options: Some(EncryptOptions {
5657
query_type: Some("rangePreview".into()),

src/client/csfle/client_encryption/encrypt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl ClientEncryption {
7474
}
7575
if let Some(range_options) = &opts.range_options {
7676
let options_doc = bson::to_document(range_options)?;
77-
builder = builder.range_options(options_doc)?;
77+
builder = builder.algorithm_range(options_doc)?;
7878
}
7979
Ok(builder)
8080
}

src/test/csfle.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,7 @@ async fn custom_key_material() -> Result<()> {
218218
datakeys.insert_one(key_doc).await?;
219219

220220
let encrypted = enc
221-
.encrypt(
222-
"test",
223-
EncryptKey::Id(new_key_id),
224-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
225-
)
221+
.encrypt("test", EncryptKey::Id(new_key_id), Algorithm::Deterministic)
226222
.await?;
227223
let expected = base64::decode(
228224
"AQAAAAAAAAAAAAAAAAAAAAACz0ZOLuuhEYi807ZXTdhbqhLaS2/t9wLifJnnNYwiw79d75QYIZ6M/\
@@ -370,7 +366,7 @@ async fn data_key_double_encryption() -> Result<()> {
370366
.encrypt(
371367
format!("hello {}", provider.name()),
372368
EncryptKey::Id(datakey_id),
373-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
369+
Algorithm::Deterministic,
374370
)
375371
.await?;
376372
assert_eq!(encrypted.subtype, BinarySubtype::Encrypted);
@@ -390,7 +386,7 @@ async fn data_key_double_encryption() -> Result<()> {
390386
.encrypt(
391387
format!("hello {}", provider.name()),
392388
EncryptKey::AltName(format!("{}_altname", provider.name())),
393-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
389+
Algorithm::Deterministic,
394390
)
395391
.await?;
396392
assert_eq!(other_encrypted.subtype, BinarySubtype::Encrypted);
@@ -491,7 +487,7 @@ async fn external_key_vault() -> Result<()> {
491487
.encrypt(
492488
"test",
493489
EncryptKey::Id(base64_uuid("LOCALAAAAAAAAAAAAAAAAA==")?),
494-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
490+
Algorithm::Deterministic,
495491
)
496492
.await;
497493
if with_external_key_vault {
@@ -811,8 +807,8 @@ async fn run_corpus_test(local_schema: bool) -> Result<()> {
811807
return Err(failure!("Invalid method {:?}", method));
812808
}
813809
let algo = match subdoc.get_str("algo")? {
814-
"rand" => Algorithm::AeadAes256CbcHmacSha512Random,
815-
"det" => Algorithm::AeadAes256CbcHmacSha512Deterministic,
810+
"rand" => Algorithm::Random,
811+
"det" => Algorithm::Deterministic,
816812
s => return Err(failure!("Invalid algorithm {:?}", s)),
817813
};
818814
let kms = KmsProvider::from_name(subdoc.get_str("kms")?);
@@ -973,7 +969,7 @@ async fn validate_roundtrip(
973969
.encrypt(
974970
value.clone(),
975971
EncryptKey::Id(key_id),
976-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
972+
Algorithm::Deterministic,
977973
)
978974
.await?;
979975
let decrypted = client_encryption.decrypt(encrypted.as_raw_binary()).await?;
@@ -1543,7 +1539,7 @@ impl DeadlockTestCase {
15431539
.encrypt(
15441540
RawBson::String("string0".to_string()),
15451541
EncryptKey::AltName("local".to_string()),
1546-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
1542+
Algorithm::Deterministic,
15471543
)
15481544
.await?;
15491545

@@ -2551,11 +2547,7 @@ impl DecryptionEventsTestdata {
25512547
)?;
25522548
let key_id = client_encryption.create_data_key(MasterKey::Local).await?;
25532549
let ciphertext = client_encryption
2554-
.encrypt(
2555-
"hello",
2556-
EncryptKey::Id(key_id),
2557-
Algorithm::AeadAes256CbcHmacSha512Deterministic,
2558-
)
2550+
.encrypt("hello", EncryptKey::Id(key_id), Algorithm::Deterministic)
25592551
.await?;
25602552
let mut malformed_ciphertext = ciphertext.clone();
25612553
let last = malformed_ciphertext.bytes.last_mut().unwrap();
@@ -3125,6 +3117,7 @@ async fn range_explicit_encryption_test(
31253117
.encrypt(
31263118
bson_numbers[num].clone(),
31273119
key1_id.clone(),
3120+
#[allow(deprecated)]
31283121
Algorithm::RangePreview,
31293122
)
31303123
.contention_factor(0)
@@ -3144,6 +3137,7 @@ async fn range_explicit_encryption_test(
31443137
.encrypt(
31453138
bson_numbers[&6].clone(),
31463139
key1_id.clone(),
3140+
#[allow(deprecated)]
31473141
Algorithm::RangePreview,
31483142
)
31493143
.contention_factor(0)
@@ -3256,6 +3250,7 @@ async fn range_explicit_encryption_test(
32563250
// Case 6: Encrypting a document greater than the maximum errors
32573251
if bson_type != "DoubleNoPrecision" && bson_type != "DecimalNoPrecision" {
32583252
let num = get_raw_bson_from_num(bson_type, 201);
3253+
#[allow(deprecated)]
32593254
let error = client_encryption
32603255
.encrypt(num, key1_id.clone(), Algorithm::RangePreview)
32613256
.contention_factor(0)
@@ -3272,6 +3267,7 @@ async fn range_explicit_encryption_test(
32723267
} else {
32733268
rawdoc! { &key: { "$numberInt": "6" } }
32743269
};
3270+
#[allow(deprecated)]
32753271
let error = client_encryption
32763272
.encrypt(value, key1_id.clone(), Algorithm::RangePreview)
32773273
.contention_factor(0)
@@ -3293,6 +3289,7 @@ async fn range_explicit_encryption_test(
32933289
.encrypt(
32943290
bson_numbers[&6].clone(),
32953291
key1_id.clone(),
3292+
#[allow(deprecated)]
32963293
Algorithm::RangePreview,
32973294
)
32983295
.contention_factor(0)

0 commit comments

Comments
 (0)