Skip to content

Commit b321a46

Browse files
authored
chore(rust): prepare rust 1.1.0 release (#782)
1 parent e284b64 commit b321a46

36 files changed

+3429
-3009
lines changed

AwsEncryptionSDK/runtimes/rust/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-esdk"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
edition = "2021"
55
rust-version = "1.81.0"
66
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]
@@ -17,8 +17,8 @@ readme = "README.md"
1717

1818
[dependencies]
1919
aws-config = "1.6.2"
20-
aws-lc-rs = "=1.13.0"
21-
aws-lc-sys = "=0.28.2"
20+
aws-lc-rs = "=1.13.1"
21+
aws-lc-sys = "=0.29.0"
2222
aws-sdk-dynamodb = "1.73.0"
2323
aws-sdk-kms = "1.67.0"
2424
aws-smithy-runtime-api = {version = "1.8.0", features = ["client"] }

AwsEncryptionSDK/runtimes/rust/start_release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ cargo clippy --example main
6565

6666
# replace local path with latest dafny-runtime from crates.io
6767
cargo rm dafny_runtime
68-
cargo add dafny-runtime -F sync
68+
cargo add dafny-runtime -F sync -F small-int
6969

7070
# Run cargo test and example tests
7171
cargo test --release

TestVectors/runtimes/rust/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ wrapped-client = []
1515

1616
[dependencies]
1717
aws-config = "1.6.2"
18-
aws-lc-rs = "=1.13.0"
19-
aws-lc-sys = "=0.28.2"
18+
aws-lc-rs = "=1.13.1"
19+
aws-lc-sys = "=0.29.0"
2020
aws-sdk-dynamodb = "1.73.0"
2121
aws-sdk-kms = "1.67.0"
2222
aws-smithy-runtime-api = {version = "1.8.0", features = ["client"] }

releases/rust/esdk/Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-esdk"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
edition = "2021"
55
rust-version = "1.81.0"
66
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]
@@ -16,21 +16,21 @@ readme = "README.md"
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
aws-config = "1.5.15"
20-
aws-lc-rs = "=1.12.2"
21-
aws-lc-sys = "=0.25.1"
22-
aws-sdk-dynamodb = "1.62.0"
23-
aws-sdk-kms = "1.57.0"
24-
aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] }
25-
aws-smithy-types = "1.2.12"
26-
chrono = "0.4.39"
19+
aws-config = "1.6.2"
20+
aws-lc-rs = "=1.13.1"
21+
aws-lc-sys = "=0.29.0"
22+
aws-sdk-dynamodb = "1.73.0"
23+
aws-sdk-kms = "1.67.0"
24+
aws-smithy-runtime-api = {version = "1.8.0", features = ["client"] }
25+
aws-smithy-types = "1.3.1"
26+
chrono = "0.4.41"
2727
cpu-time = "1.0.0"
28-
dafny-runtime = { version = "0.2.0", features = ["sync"] }
28+
dafny-runtime = { version = "0.3.0", features = ["sync", "small-int"] }
2929
dashmap = "6.1.0"
30-
pem = "3.0.4"
31-
rand = "0.9.0"
32-
tokio = {version = "1.43.0", features = ["full"] }
33-
uuid = { version = "1.12.1", features = ["v4"] }
30+
pem = "3.0.5"
31+
rand = "0.9.1"
32+
tokio = {version = "1.45.0", features = ["full"] }
33+
uuid = { version = "1.16.0", features = ["v4"] }
3434

3535
[[example]]
3636
name = "main"

releases/rust/esdk/examples/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ and how to set up some common configuration patterns.
77

88
## APIs
99

10-
The AWS Encryption SDK provides two high-level APIs:
11-
one-step APIs that process the entire operation in memory
12-
and streaming APIs.
10+
The AWS Encryption SDK provides a high-level,
11+
one-step API that processes encryption
12+
and decryption operations entirely in memory.
1313

1414
You can find examples that demonstrate these APIs
1515
in the [`examples/`](./) directory.
@@ -48,6 +48,7 @@ We start with AWS KMS examples, then show how to use other wrapping keys.
4848

4949
Keyrings are the most common way for you to configure the AWS Encryption SDK.
5050
They determine how the AWS Encryption SDK protects your data.
51+
For more information about keyrings, see the [AWS Developer Guide on using Keyrings](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html).
5152
You can find these examples in [`examples/keyring`](./keyring).
5253

5354
### Cryptographic Materials Managers
@@ -61,6 +62,7 @@ This can include things like
6162
enforcing the use of certain algorithm suites or encryption context settings,
6263
reusing data keys across messages,
6364
or changing how you interact with keyrings.
65+
For more information about cryptographic materials managers, see the [AWS Developer Guide on cryptographic materials managers](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#crypt-materials-manager).
6466
You can find these examples in
6567
[`examples/cryptographic_materials_manager`](./cryptographic_materials_manager).
6668

releases/rust/esdk/examples/client_supplier/regional_role_client_supplier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl ClientSupplier for RegionalRoleClientSupplier {
4545

4646
let sdk_config = tokio::task::block_in_place(|| {
4747
tokio::runtime::Handle::current().block_on(async {
48-
aws_config::load_defaults(aws_config::BehaviorVersion::v2024_03_28()).await
48+
aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await
4949
})
5050
});
5151
let kms_config = aws_sdk_kms::config::Builder::from(&sdk_config)

releases/rust/esdk/examples/example_utils/utils.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,19 @@ pub(crate) fn x962_to_x509(public_key: &[u8], nid: i32) -> Result<Vec<u8>, Strin
128128

129129
fn get_nid(x: EcdhCurveSpec) -> i32 {
130130
match x {
131-
EcdhCurveSpec::EccNistP256 {} => aws_lc_sys::NID_X9_62_prime256v1,
132-
EcdhCurveSpec::EccNistP384 {} => aws_lc_sys::NID_secp384r1,
133-
EcdhCurveSpec::EccNistP521 {} => aws_lc_sys::NID_secp521r1,
134-
EcdhCurveSpec::Sm2 {} => panic!("No SM2 in Rust"),
131+
EcdhCurveSpec::EccNistP256 => aws_lc_sys::NID_X9_62_prime256v1,
132+
EcdhCurveSpec::EccNistP384 => aws_lc_sys::NID_secp384r1,
133+
EcdhCurveSpec::EccNistP521 => aws_lc_sys::NID_secp521r1,
134+
EcdhCurveSpec::Sm2 => panic!("No SM2 in Rust"),
135135
}
136136
}
137137

138138
fn get_alg(x: EcdhCurveSpec) -> &'static aws_lc_rs::agreement::Algorithm {
139139
match x {
140-
EcdhCurveSpec::EccNistP256 {} => &aws_lc_rs::agreement::ECDH_P256,
141-
EcdhCurveSpec::EccNistP384 {} => &aws_lc_rs::agreement::ECDH_P384,
142-
EcdhCurveSpec::EccNistP521 {} => &aws_lc_rs::agreement::ECDH_P521,
143-
EcdhCurveSpec::Sm2 {} => panic!("No SM2 in Rust"),
140+
EcdhCurveSpec::EccNistP256 => &aws_lc_rs::agreement::ECDH_P256,
141+
EcdhCurveSpec::EccNistP384 => &aws_lc_rs::agreement::ECDH_P384,
142+
EcdhCurveSpec::EccNistP521 => &aws_lc_rs::agreement::ECDH_P521,
143+
EcdhCurveSpec::Sm2 => panic!("No SM2 in Rust"),
144144
}
145145
}
146146

releases/rust/esdk/src/aes_gcm.rs

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ impl AES_GCM {
113113
msg: &::dafny_runtime::Sequence<u8>,
114114
aad: &::dafny_runtime::Sequence<u8>,
115115
) -> Rc<_Wrappers_Compile::Result<Rc<AESEncryptOutput>, Rc<DafnyError>>> {
116-
let iv: Vec<u8> = iv.iter().collect();
117-
let key: Vec<u8> = key.iter().collect();
118-
let msg: Vec<u8> = msg.iter().collect();
119-
let aad: Vec<u8> = aad.iter().collect();
116+
let iv = &iv.to_array();
117+
let key = &key.to_array();
118+
let msg = &msg.to_array();
119+
let aad = &aad.to_array();
120120

121121
if *self.keyLength() as usize != key.len() {
122122
let msg = format!(
@@ -135,11 +135,11 @@ impl AES_GCM {
135135
return enc_result(&msg);
136136
}
137137

138-
match self.do_aes_encrypt(&iv, &key, &msg, &aad) {
138+
match self.do_aes_encrypt(iv, key, msg, aad) {
139139
Ok(x) => Rc::new(_Wrappers_Compile::Result::Success {
140140
value: Rc::new(AESEncryptOutput::AESEncryptOutput {
141-
cipherText: x.cipher_text.iter().cloned().collect(),
142-
authTag: x.auth_tag.iter().cloned().collect(),
141+
cipherText: dafny_runtime::Sequence::from_array_owned(x.cipher_text),
142+
authTag: dafny_runtime::Sequence::from_array_owned(x.auth_tag),
143143
}),
144144
}),
145145
Err(e) => {
@@ -158,11 +158,11 @@ impl AES_GCM {
158158
iv: &::dafny_runtime::Sequence<u8>,
159159
aad: &::dafny_runtime::Sequence<u8>,
160160
) -> Rc<_Wrappers_Compile::Result<::dafny_runtime::Sequence<u8>, Rc<DafnyError>>> {
161-
let key: Vec<u8> = key.iter().collect();
162-
let cipher_text: Vec<u8> = cipher_text.iter().collect();
163-
let auth_tag: Vec<u8> = auth_tag.iter().collect();
164-
let iv: Vec<u8> = iv.iter().collect();
165-
let aad: Vec<u8> = aad.iter().collect();
161+
let key = &key.to_array();
162+
let cipher_text = &cipher_text.to_array();
163+
let auth_tag = &auth_tag.to_array();
164+
let iv = &iv.to_array();
165+
let aad = &aad.to_array();
166166

167167
if *self.keyLength() as usize != key.len() {
168168
let msg = format!(
@@ -191,9 +191,9 @@ impl AES_GCM {
191191
return dec_result(&msg);
192192
}
193193

194-
match self.do_aes_decrypt(&key, &cipher_text, &auth_tag, &iv, &aad) {
194+
match self.do_aes_decrypt(key, cipher_text, auth_tag, iv, aad) {
195195
Ok(x) => Rc::new(_Wrappers_Compile::Result::Success {
196-
value: x.iter().cloned().collect(),
196+
value: dafny_runtime::Sequence::from_array_owned(x),
197197
}),
198198
Err(e) => {
199199
let msg = format!("AES Decrypt : {}", e);
@@ -208,23 +208,18 @@ mod tests {
208208
use super::*;
209209
#[test]
210210
fn test_generate() {
211-
let iv: ::dafny_runtime::Sequence<u8> = [1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
212-
.iter()
213-
.cloned()
214-
.collect();
215-
let key: ::dafny_runtime::Sequence<u8> = [
211+
let iv: ::dafny_runtime::Sequence<u8> = dafny_runtime::Sequence::from_array_owned(vec![
212+
1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
213+
]);
214+
let key: ::dafny_runtime::Sequence<u8> = dafny_runtime::Sequence::from_array_owned(vec![
216215
2u8, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
217216
25, 26, 27, 28, 29, 30, 31, 32, 33,
218-
]
219-
.iter()
220-
.cloned()
221-
.collect();
222-
let msg: ::dafny_runtime::Sequence<u8> = [2u8, 4, 6, 8, 10, 12].iter().cloned().collect();
223-
let aad: ::dafny_runtime::Sequence<u8> =
224-
[3u8, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
225-
.iter()
226-
.cloned()
227-
.collect();
217+
]);
218+
let msg: ::dafny_runtime::Sequence<u8> =
219+
dafny_runtime::Sequence::from_array_owned(vec![2u8, 4, 6, 8, 10, 12]);
220+
let aad: ::dafny_runtime::Sequence<u8> = dafny_runtime::Sequence::from_array_owned(vec![
221+
3u8, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
222+
]);
228223

229224
let alg = AES_GCM::AES_GCM {
230225
keyLength: 32,

releases/rust/esdk/src/aes_kdf_ctr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ pub mod AesKdfCtr {
5858
Rc<crate::software::amazon::cryptography::primitives::internaldafny::types::Error>,
5959
>,
6060
> {
61-
let nonce: Vec<u8> = nonce.iter().collect();
62-
let key: Vec<u8> = key.iter().collect();
63-
match ctr_stream(&nonce, &key, length) {
61+
let nonce = &nonce.to_array();
62+
let key = &key.to_array();
63+
match ctr_stream(nonce, key, length) {
6464
Ok(x) => Rc::new(_Wrappers_Compile::Result::Success {
65-
value: x.iter().cloned().collect(),
65+
value: dafny_runtime::Sequence::from_array_owned(x),
6666
}),
6767
Err(e) => {
6868
let msg = format!("Aes Kdf Ctr : {}", e);

releases/rust/esdk/src/dafny_libraries.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,19 @@ pub mod DafnyLibraries {
180180
let file_name = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(path);
181181
let path = Path::new(&file_name);
182182

183+
if let Some(parent) = path.parent() {
184+
if let Err(why) = std::fs::create_dir_all(parent) {
185+
let err_msg = format!(
186+
"couldn't create directory {} from {}: {}",
187+
path.display(),
188+
curr_dir(),
189+
why
190+
);
191+
let err_msg = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&err_msg);
192+
return (true, err_msg);
193+
}
194+
}
195+
183196
let maybe_file = std::fs::OpenOptions::new()
184197
.append(append)
185198
.write(true)

0 commit comments

Comments
 (0)