mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
update shellchat net tls mozilla for rustls v22.2
This commit is contained in:
parent
1f6ec1fe69
commit
e608e7bb30
1 changed files with 8 additions and 21 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
use crate::Tls;
|
||||||
|
use locales::t;
|
||||||
use rustls::pki_types::ServerName;
|
use rustls::pki_types::ServerName;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
|
@ -5,14 +7,8 @@ use std::io::Write;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use std::str::from_utf8;
|
use std::str::from_utf8;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use locales::t;
|
|
||||||
#[cfg(feature = "rootCA")]
|
#[cfg(feature = "rootCA")]
|
||||||
use modals::Modals;
|
use {modals::Modals, std::convert::TryInto, xous_names::XousNames};
|
||||||
#[cfg(feature = "rootCA")]
|
|
||||||
use xous_names::XousNames;
|
|
||||||
|
|
||||||
use crate::Tls;
|
|
||||||
|
|
||||||
pub fn shellchat<'a>(mut tokens: impl Iterator<Item = &'a str>) -> Result<Option<String>, xous::Error> {
|
pub fn shellchat<'a>(mut tokens: impl Iterator<Item = &'a str>) -> Result<Option<String>, xous::Error> {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
|
|
@ -43,18 +39,9 @@ pub fn shellchat<'a>(mut tokens: impl Iterator<Item = &'a str>) -> Result<Option
|
||||||
// save/trust all Root CA's in webpki-roots en-masse
|
// save/trust all Root CA's in webpki-roots en-masse
|
||||||
#[cfg(feature = "rootCA")]
|
#[cfg(feature = "rootCA")]
|
||||||
Some("mozilla") => {
|
Some("mozilla") => {
|
||||||
let rotas: Vec<crate::RustlsOwnedTrustAnchor> = webpki_roots::TLS_SERVER_ROOTS
|
let otas: Vec<crate::OwnedTrustAnchor> =
|
||||||
.0
|
webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| (*ta).clone().into()).collect();
|
||||||
.iter()
|
let mut count: u32 = otas.len().try_into().unwrap();
|
||||||
.map(|ta| {
|
|
||||||
crate::RustlsOwnedTrustAnchor::from_subject_spki_name_constraints(
|
|
||||||
ta.subject,
|
|
||||||
ta.spki,
|
|
||||||
ta.name_constraints,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
let mut count: u32 = rotas.len().try_into().unwrap();
|
|
||||||
let xns = XousNames::new().unwrap();
|
let xns = XousNames::new().unwrap();
|
||||||
let modals = Modals::new(&xns).unwrap();
|
let modals = Modals::new(&xns).unwrap();
|
||||||
modals
|
modals
|
||||||
|
|
@ -62,8 +49,8 @@ pub fn shellchat<'a>(mut tokens: impl Iterator<Item = &'a str>) -> Result<Option
|
||||||
.expect("no progress");
|
.expect("no progress");
|
||||||
count = 0;
|
count = 0;
|
||||||
let tls = Tls::new();
|
let tls = Tls::new();
|
||||||
for rota in rotas {
|
for rota in otas {
|
||||||
tls.save_rota(&rota).unwrap_or_else(|e| log::warn!("{e}"));
|
tls.save_ta(&rota).unwrap_or_else(|e| log::warn!("{e}"));
|
||||||
modals.update_progress(count).expect("no progress");
|
modals.update_progress(count).expect("no progress");
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue