tidy-up tls cargo & use

This commit is contained in:
nworbnhoj 2023-06-26 08:12:11 +10:00
parent 21961ad756
commit a741e7988b
4 changed files with 40 additions and 27 deletions

View file

@ -20,5 +20,5 @@ net = { path = "../../services/net" }
pddb = { path = "../../services/pddb" } pddb = { path = "../../services/pddb" }
rkyv = "0.4.3" rkyv = "0.4.3"
rustls = "0.21.2" rustls = { version = "0.21.2", features = ["dangerous_configuration"]}
x509-parser = "0.15.0" x509-parser = "0.15.0"

View file

@ -7,7 +7,7 @@ use rkyv::{
AlignedVec, Archive, Deserialize, Serialize, AlignedVec, Archive, Deserialize, Serialize,
}; };
use rustls::{Certificate, DistinguishedName, RootCertStore}; use rustls::{Certificate, DistinguishedName, RootCertStore};
use std::convert::TryFrom; use std::cmp::min;
use std::convert::{Into, TryFrom}; use std::convert::{Into, TryFrom};
use std::fs::File; use std::fs::File;
use std::io::{Error, ErrorKind, Read, Write}; use std::io::{Error, ErrorKind, Read, Write};

View file

@ -76,12 +76,19 @@ tracing-subscriber = {version = "0.3.11", optional = true}
# for rustls testing # for rustls testing
tls = {path="../../libs/tls"} tls = {path="../../libs/tls"}
rustls = {version = "0.21.2", optional = true} # note requirement for patch to xous-ring in workspace Cargo.toml
# rustls = {path="../../../rustls/rustls"} # note requirement for patch to xous-ring in workspace Cargo.toml
rustls = {version = "0.21.2", optional = true}
webpki-roots = {version = "0.22.4", optional = true} webpki-roots = {version = "0.22.4", optional = true}
ring = {version = "0.16.20", optional = true} # for testing ring math functions # note requirement for patch to xous-ring in workspace Cargo.toml
tungstenite = {version = "0.17.3", optional = true, features = ["rustls-tls-webpki-roots"]}
url = {version = "2.2.2", optional = true} url = {version = "2.2.2", optional = true}
x509-parser = "0.15.0"
# for testing ring math functions
# note requirement for patch to xous-ring in workspace Cargo.toml
ring = {version = "0.16.20", optional = true}
# for websocket testing
tungstenite = {version = "0.17.3", optional = true, features = ["rustls-tls-webpki-roots"]}
# for performance testing # for performance testing
perflib = {path="../../tools/perflib", optional = true} perflib = {path="../../tools/perflib", optional = true}

View file

@ -1,30 +1,36 @@
use crate::{ShellCmdApi, CommonEnv}; use crate::{CommonEnv, ShellCmdApi};
use com::api::NET_MTU; use com::api::NET_MTU;
use xous_ipc::String;
#[cfg(any(feature="precursor", feature="renode"))]
use net::XousServerId;
use net::NetPingCallback; use net::NetPingCallback;
use xous::MessageEnvelope;
use num_traits::*; use num_traits::*;
use std::net::{IpAddr, TcpStream, TcpListener}; use rustls::internal::msgs::base::PayloadU16;
use std::io::Write; use rustls::internal::msgs::handshake::DistinguishedName;
#[cfg(feature = "tls")]
use rustls::{Certificate, OwnedTrustAnchor};
use std::io::Read; use std::io::Read;
use std::sync::{Arc, Mutex}; use std::io::Write;
use std::time::{Duration, Instant}; use std::net::{IpAddr, TcpListener, TcpStream};
use std::thread;
use std::sync::mpsc; use std::sync::mpsc;
#[cfg(feature="ditherpunk")] use std::sync::{Arc, Mutex};
use std::str::FromStr; use std::thread;
#[cfg(feature="ditherpunk")] use std::time::{Duration, Instant};
use gam::DecodePng; use xous::MessageEnvelope;
#[cfg(feature="tls")] use xous_ipc::String;
use std::convert::TryInto;
#[cfg(feature="tls")] #[cfg(feature = "ditherpunk")]
use tungstenite::{WebSocket, stream::MaybeTlsStream}; use {gam::DecodePng, std::str::FromStr};
#[cfg(feature="shellperf")]
#[cfg(any(feature = "precursor", feature = "renode"))]
use net::XousServerId;
#[cfg(feature = "shellperf")]
use perflib::*; use perflib::*;
#[cfg(feature = "tls")]
use {
rustls::{Certificate, OwnedTrustAnchor},
std::convert::TryInto,
tls::{danger, Trusted},
tungstenite::{stream::MaybeTlsStream, WebSocket},
};
pub struct NetCmd { pub struct NetCmd {
callback_id: Option<u32>, callback_id: Option<u32>,
callback_conn: u32, callback_conn: u32,