Skip to content

Commit f2997be

Browse files
authored
chore(rust): Rust release version 1.1.0 (#1885)
1 parent fc64e62 commit f2997be

32 files changed

+6726
-4996
lines changed

releases/rust/db_esdk/Cargo.toml

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-db-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,20 +16,20 @@ 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.0"
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-
tokio = {version = "1.43.0", features = ["full"] }
32-
uuid = { version = "1.12.1", features = ["v4"] }
30+
pem = "3.0.5"
31+
tokio = {version = "1.45.0", features = ["full"] }
32+
uuid = { version = "1.16.0", features = ["v4"] }
3333

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

releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
[package]
2-
name = "dafny_runtime"
2+
name = "dafny-runtime"
33
version = "0.3.0"
44
edition = "2021"
5+
keywords = ["dafny"]
6+
license = "ISC AND (Apache-2.0 OR ISC)"
7+
description = "dafny-runtime is the runtime support library for Rust code gerated from Dafny."
8+
repository = "https://github.com/aws/aws-database-encryption-sdk-dynamodb/tree/main/releases/rust/db_esdk/dafny_runtime_rust"
9+
authors = ["AWS-CryptoTools"]
10+
readme = "README.md"
511

612
[dependencies]
713
once_cell = "1.21.3"

releases/rust/db_esdk/src/aes_gcm.rs

+24-29
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/db_esdk/src/aes_kdf_ctr.rs

+4-4
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/db_esdk/src/dafny_libraries.rs

+13
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)

releases/rust/db_esdk/src/deps/aws_cryptography_materialProviders/operation/create_default_cryptographic_materials_manager/_create_default_cryptographic_materials_manager_input.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
66
/// Inputs for creating a Default Cryptographic Materials Manager.
77
pub struct CreateDefaultCryptographicMaterialsManagerInput {
8-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
8+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
99
pub keyring: ::std::option::Option<
1010
crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
1111
>,
1212
}
1313
impl CreateDefaultCryptographicMaterialsManagerInput {
14-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
14+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
1515
pub fn keyring(
1616
&self,
1717
) -> &::std::option::Option<
@@ -38,7 +38,7 @@ pub struct CreateDefaultCryptographicMaterialsManagerInputBuilder {
3838
>,
3939
}
4040
impl CreateDefaultCryptographicMaterialsManagerInputBuilder {
41-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
41+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
4242
pub fn keyring(
4343
mut self,
4444
input: impl ::std::convert::Into<
@@ -48,7 +48,7 @@ impl CreateDefaultCryptographicMaterialsManagerInputBuilder {
4848
self.keyring = ::std::option::Option::Some(input.into());
4949
self
5050
}
51-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
51+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
5252
pub fn set_keyring(
5353
mut self,
5454
input: ::std::option::Option<
@@ -58,7 +58,7 @@ impl CreateDefaultCryptographicMaterialsManagerInputBuilder {
5858
self.keyring = input;
5959
self
6060
}
61-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
61+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
6262
pub fn get_keyring(
6363
&self,
6464
) -> &::std::option::Option<

releases/rust/db_esdk/src/deps/aws_cryptography_materialProviders/operation/create_default_cryptographic_materials_manager/builders.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl CreateDefaultCryptographicMaterialsManagerFluentBuilder {
6464
crate::deps::aws_cryptography_materialProviders::operation::create_default_cryptographic_materials_manager::CreateDefaultCryptographicMaterialsManager::send(&self.client, input).await
6565
}
6666

67-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
67+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
6868
pub fn keyring(
6969
mut self,
7070
input: impl ::std::convert::Into<
@@ -74,7 +74,7 @@ impl CreateDefaultCryptographicMaterialsManagerFluentBuilder {
7474
self.inner = self.inner.keyring(input.into());
7575
self
7676
}
77-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
77+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
7878
pub fn set_keyring(
7979
mut self,
8080
input: ::std::option::Option<
@@ -84,7 +84,7 @@ impl CreateDefaultCryptographicMaterialsManagerFluentBuilder {
8484
self.inner = self.inner.set_keyring(input);
8585
self
8686
}
87-
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
87+
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
8888
pub fn get_keyring(
8989
&self,
9090
) -> &::std::option::Option<

releases/rust/db_esdk/src/deps/aws_cryptography_materialProviders/operation/create_required_encryption_context_cmm/_create_required_encryption_context_cmm_input.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
66
/// Inputs for creating an Required Encryption Context Cryptographic Materials Manager.
77
pub struct CreateRequiredEncryptionContextCmmInput {
8-
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
8+
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
99
pub keyring: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef>,
1010
/// A list of Encryption Context keys which are required to be supplied during encryption and decryption, and correspond to Encryption Context key-value pairs which are not stored on the resulting message.
1111
pub required_encryption_context_keys: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12-
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
12+
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
1313
pub underlying_cmm: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
1414
}
1515
impl CreateRequiredEncryptionContextCmmInput {
16-
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
16+
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
1717
pub fn keyring(
1818
&self,
1919
) -> &::std::option::Option<
@@ -27,7 +27,7 @@ impl CreateRequiredEncryptionContextCmmInput {
2727
) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
2828
&self.required_encryption_context_keys
2929
}
30-
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
30+
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
3131
pub fn underlying_cmm(&self) -> &::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>{
3232
&self.underlying_cmm
3333
}
@@ -50,7 +50,7 @@ pub(crate) required_encryption_context_keys: ::std::option::Option<::std::vec::V
5050
pub(crate) underlying_cmm: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
5151
}
5252
impl CreateRequiredEncryptionContextCmmInputBuilder {
53-
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
53+
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
5454
pub fn keyring(
5555
mut self,
5656
input: impl ::std::convert::Into<
@@ -60,7 +60,7 @@ impl CreateRequiredEncryptionContextCmmInputBuilder {
6060
self.keyring = ::std::option::Option::Some(input.into());
6161
self
6262
}
63-
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
63+
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
6464
pub fn set_keyring(
6565
mut self,
6666
input: ::std::option::Option<
@@ -70,7 +70,7 @@ impl CreateRequiredEncryptionContextCmmInputBuilder {
7070
self.keyring = input;
7171
self
7272
}
73-
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
73+
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
7474
pub fn get_keyring(
7575
&self,
7676
) -> &::std::option::Option<
@@ -100,23 +100,23 @@ impl CreateRequiredEncryptionContextCmmInputBuilder {
100100
) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
101101
&self.required_encryption_context_keys
102102
}
103-
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
103+
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
104104
pub fn underlying_cmm(
105105
mut self,
106106
input: impl ::std::convert::Into<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
107107
) -> Self {
108108
self.underlying_cmm = ::std::option::Option::Some(input.into());
109109
self
110110
}
111-
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
111+
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
112112
pub fn set_underlying_cmm(
113113
mut self,
114114
input: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
115115
) -> Self {
116116
self.underlying_cmm = input;
117117
self
118118
}
119-
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
119+
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
120120
pub fn get_underlying_cmm(&self) -> &::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>{
121121
&self.underlying_cmm
122122
}

0 commit comments

Comments
 (0)