mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
patches for debug
This commit is contained in:
parent
9a4933b648
commit
a5aee2b0d5
4 changed files with 23 additions and 27 deletions
31
Cargo.lock
generated
31
Cargo.lock
generated
|
|
@ -3140,8 +3140,8 @@ version = "0.20.6"
|
|||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"sct 0.6.1",
|
||||
"webpki 0.22.0",
|
||||
"sct",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3152,8 +3152,8 @@ checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033"
|
|||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"sct 0.7.0",
|
||||
"webpki 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sct",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3183,14 +3183,6 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.6.1"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.7.0"
|
||||
|
|
@ -4045,7 +4037,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"url",
|
||||
"webpki 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
|
|
@ -4486,16 +4478,7 @@ dependencies = [
|
|||
name = "webpki"
|
||||
version = "0.22.0"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
|
@ -4506,7 +4489,7 @@ version = "0.22.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf"
|
||||
dependencies = [
|
||||
"webpki 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -138,4 +138,7 @@ branch="main"
|
|||
path = "imports/getrandom"
|
||||
|
||||
[patch.crates-io.ring]
|
||||
path = "../ring"
|
||||
path = "../ring"
|
||||
|
||||
[patch.crates-io.webpki]
|
||||
path = "../webpki-0.22.0"
|
||||
|
|
@ -193,7 +193,7 @@ fn setup_icmp(iface: &mut Interface::<NetPhy>) -> SocketHandle {
|
|||
|
||||
fn main() -> ! {
|
||||
log_server::init_wait().unwrap();
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
log::set_max_level(log::LevelFilter::Debug);
|
||||
log::info!("my PID is {}", xous::process::id());
|
||||
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
|
|
|
|||
|
|
@ -386,7 +386,10 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
}
|
||||
}
|
||||
"tls" => {
|
||||
log::set_max_level(log::LevelFilter::Trace);
|
||||
log::info!("starting TLS run");
|
||||
let mut root_store = rustls::RootCertStore::empty();
|
||||
log::info!("create root store");
|
||||
root_store.add_server_trust_anchors(
|
||||
webpki_roots::TLS_SERVER_ROOTS
|
||||
.0
|
||||
|
|
@ -399,16 +402,20 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
)
|
||||
})
|
||||
);
|
||||
log::info!("build TLS client config");
|
||||
let config = rustls::ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(root_store)
|
||||
.with_no_client_auth();
|
||||
|
||||
log::info!("point TLS to bunniefoo.com");
|
||||
let server_name = "bunniefoo.com".try_into().unwrap();
|
||||
let mut conn = rustls::ClientConnection::new(Arc::new(config), server_name).unwrap();
|
||||
|
||||
let mut sock = TcpStream::connect("google.com:443").unwrap();
|
||||
log::info!("connect TCPstream to bunniefoo.com");
|
||||
let mut sock = TcpStream::connect("bunniefoo.com:443").unwrap();
|
||||
let mut tls = rustls::Stream::new(&mut conn, &mut sock);
|
||||
log::info!("create http headers and write to server");
|
||||
tls.write_all(
|
||||
concat!(
|
||||
"GET / HTTP/1.1\r\n",
|
||||
|
|
@ -420,6 +427,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
.as_bytes(),
|
||||
)
|
||||
.unwrap();
|
||||
log::info!("readout cipher suite");
|
||||
let ciphersuite = tls
|
||||
.conn
|
||||
.negotiated_cipher_suite()
|
||||
|
|
@ -429,9 +437,11 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
ciphersuite.suite()
|
||||
);
|
||||
let mut plaintext = Vec::new();
|
||||
log::info!("read TLS response");
|
||||
tls.read_to_end(&mut plaintext).unwrap();
|
||||
log::info!("len: {}", plaintext.len());
|
||||
log::info!("{}", std::str::from_utf8(&plaintext).unwrap_or("utf-error"));
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
}
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
"ping" => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue