diff --git a/Cargo.toml b/Cargo.toml index 437ad15..aae5110 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "embedded-tls" -version = "0.15.0" +version = "0.16.0" edition = "2021" description = "TLS 1.3 client with no_std support and no allocator" documentation = "https://docs.rs/embedded-tls" @@ -23,9 +23,9 @@ digest = { version = "0.10.3", default-features = false, features = ["core-api"] typenum = { version = "1.15.0", default-features = false } heapless = { version = "0.7", default-features = false } heapless_typenum = { package = "heapless", version = "0.6", default-features = false } -embedded-io = "0.5" -embedded-io-async = { version = "0.5", optional = true } -embedded-io-adapters = { version = "0.5", optional = true } +embedded-io = "0.6" +embedded-io-async = { version = "0.6", optional = true } +embedded-io-adapters = { version = "0.6", optional = true } generic-array = { version = "0.14", default-features = false } #webpki = { version = "0.22.0", default-features = false } #webpki = { path = "../../webpki", default-features = false } diff --git a/examples/blocking/Cargo.toml b/examples/blocking/Cargo.toml index 27ff8ec..e073417 100644 --- a/examples/blocking/Cargo.toml +++ b/examples/blocking/Cargo.toml @@ -9,8 +9,8 @@ authors = [ [dependencies] embedded-tls = { path = "../..", features = ["log", "std", "webpki"], default-features = false } -embedded-io = { version = "0.5.0" } -embedded-io-adapters = { version = "0.5.0", features = ["std"] } +embedded-io = { version = "0.6.0" } +embedded-io-adapters = { version = "0.6.0", features = ["std"] } pem-parser = "0.1" env_logger = "0.10" rand = "0.8" diff --git a/examples/embassy/Cargo.toml b/examples/embassy/Cargo.toml index fe899c5..f9f8082 100644 --- a/examples/embassy/Cargo.toml +++ b/examples/embassy/Cargo.toml @@ -21,8 +21,8 @@ futures = { version = "0.3.17" } libc = "0.2.101" clap = { version = "3.0", features = ["derive", "color"] } heapless = { version = "0.7.5", default-features = false } -embedded-io-async = { version = "0.5.0" } -embedded-io-adapters = { version = "0.5.0", features = ["futures-03"] } +embedded-io-async = { version = "0.6.0" } +embedded-io-adapters = { version = "0.6.0", features = ["futures-03"] } critical-section = { version = "1.1", features = ["std"] } [patch.crates-io] diff --git a/examples/nrf52/Cargo.toml b/examples/nrf52/Cargo.toml index d1dd090..2056732 100644 --- a/examples/nrf52/Cargo.toml +++ b/examples/nrf52/Cargo.toml @@ -9,7 +9,7 @@ authors = [ [dependencies] embedded-tls = { path = "../..", default-features = false } -embedded-io = "0.5.0" +embedded-io = "0.6.0" defmt = "0.3" defmt-rtt = "0.4" panic-probe = { version = "0.3", features = ["print-defmt"] } diff --git a/examples/tokio-psk/Cargo.toml b/examples/tokio-psk/Cargo.toml index 7a41e0d..4f488e0 100644 --- a/examples/tokio-psk/Cargo.toml +++ b/examples/tokio-psk/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" [dependencies] embedded-tls = { path = "../..", features = ["log", "tokio"] } -embedded-io-adapters = { version = "0.5.0", features = ["tokio-1"] } -embedded-io-async = "0.5.0" +embedded-io-adapters = { version = "0.6.0", features = ["tokio-1"] } +embedded-io-async = "0.6.0" env_logger = "0.10" tokio = { version = "1.7", features = ["full"] } rand = "0.8" diff --git a/examples/tokio/Cargo.toml b/examples/tokio/Cargo.toml index b40e4f1..9035d8d 100644 --- a/examples/tokio/Cargo.toml +++ b/examples/tokio/Cargo.toml @@ -9,8 +9,8 @@ authors = [ [dependencies] embedded-tls = { path = "../..", features = ["log", "tokio"] } -embedded-io-adapters = { version = "0.5.0", features = ["tokio-1"] } -embedded-io-async = "0.5.0" +embedded-io-adapters = { version = "0.6.0", features = ["tokio-1"] } +embedded-io-async = "0.6.0" env_logger = "0.10" tokio = { version = "1.7", features = ["full"] } rand = "0.8" diff --git a/src/asynch.rs b/src/asynch.rs index 31a2b26..52d0991 100644 --- a/src/asynch.rs +++ b/src/asynch.rs @@ -141,7 +141,10 @@ where let key_schedule = self.key_schedule.write_state(); let slice = self.record_write_buf.close_record(key_schedule)?; - self.delegate.write_all(slice).await?; + self.delegate + .write_all(slice) + .await + .map_err(|e| TlsError::Io(e.kind()))?; key_schedule.increment_counter(); @@ -213,7 +216,10 @@ where Some(read_key_schedule), )?; - self.delegate.write_all(slice).await?; + self.delegate + .write_all(slice) + .await + .map_err(|e| TlsError::Io(e.kind()))?; self.key_schedule.write_state().increment_counter(); @@ -511,7 +517,10 @@ where if !self.record_write_buf.is_empty() { let slice = self.record_write_buf.close_record(&mut self.key_schedule)?; - self.delegate.write_all(slice).await?; + self.delegate + .write_all(slice) + .await + .map_err(|e| TlsError::Io(e.kind()))?; self.key_schedule.increment_counter(); diff --git a/src/blocking.rs b/src/blocking.rs index bc9eab1..1efe6f2 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -138,7 +138,9 @@ where let key_schedule = self.key_schedule.write_state(); let slice = self.record_write_buf.close_record(key_schedule)?; - self.delegate.write_all(slice)?; + self.delegate + .write_all(slice) + .map_err(|e| TlsError::Io(e.kind()))?; key_schedule.increment_counter(); @@ -204,7 +206,9 @@ where Some(read_key_schedule), )?; - self.delegate.write_all(slice)?; + self.delegate + .write_all(slice) + .map_err(|e| TlsError::Io(e.kind()))?; self.key_schedule.write_state().increment_counter(); @@ -503,7 +507,9 @@ where if !self.record_write_buf.is_empty() { let slice = self.record_write_buf.close_record(&mut self.key_schedule)?; - self.delegate.write_all(slice)?; + self.delegate + .write_all(slice) + .map_err(|e| TlsError::Io(e.kind()))?; self.key_schedule.increment_counter(); diff --git a/src/connection.rs b/src/connection.rs index df9d17b..82fbcb9 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -330,7 +330,9 @@ fn respond_blocking( where CipherSuite: TlsCipherSuite, { - transport.write_all(tx)?; + transport + .write_all(tx) + .map_err(|e| TlsError::Io(e.kind()))?; key_schedule.write_state().increment_counter(); @@ -372,7 +374,10 @@ async fn respond( where CipherSuite: TlsCipherSuite, { - transport.write_all(tx).await?; + transport + .write_all(tx) + .await + .map_err(|e| TlsError::Io(e.kind()))?; key_schedule.write_state().increment_counter(); diff --git a/src/lib.rs b/src/lib.rs index 593979f..3953a23 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -137,19 +137,6 @@ impl embedded_io::Error for TlsError { } } -use embedded_io::WriteAllError; -impl From> for TlsError -where - E: embedded_io::Error, -{ - fn from(e: WriteAllError) -> Self { - match e { - WriteAllError::WriteZero => Self::IoError, - WriteAllError::Other(e) => Self::Io(e.kind()), - } - } -} - #[cfg(feature = "std")] mod stdlib { use crate::config::TlsClock;