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