mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
length of a record stored is the pos field for rkyv-to-pddb
prior use of `rkyv` reserves two bytes to record `pos` pre-pended to the rkyv record the new rkyv works without having to do that because it indexes the rkyv data off the end of the stored records. Thus, all you need to know is the total length of the byte slice that stores the serialized data. This is available as the return argument when you read a PDDB key, so we don't have to explicitly store it anymore.
This commit is contained in:
parent
048e8d8373
commit
3a9a7ebf02
1 changed files with 4 additions and 3 deletions
|
|
@ -13,7 +13,7 @@ use modals::Modals;
|
|||
use ota::{ArchivedOwnedTrustAnchor, OwnedTrustAnchor};
|
||||
use rustls::pki_types::{CertificateDer, TrustAnchor};
|
||||
use rustls::{ClientConfig, ClientConnection, RootCertStore};
|
||||
use x509_parser::prelude::{parse_x509_certificate, FromDer, X509Certificate};
|
||||
use x509_parser::prelude::{FromDer, X509Certificate, parse_x509_certificate};
|
||||
use xous_names::XousNames;
|
||||
|
||||
/// PDDB Dict for tls trusted certificates keys
|
||||
|
|
@ -165,8 +165,9 @@ impl Tls {
|
|||
Ok(mut pddb_key) => {
|
||||
let mut bytes = [0u8; ota::MAX_OTA_BYTES];
|
||||
match pddb_key.read(&mut bytes) {
|
||||
Ok(_) => {
|
||||
let ata = unsafe { rkyv::access_unchecked::<ArchivedOwnedTrustAnchor>(&bytes[..]) };
|
||||
Ok(pos) => {
|
||||
let ata =
|
||||
unsafe { rkyv::access_unchecked::<ArchivedOwnedTrustAnchor>(&bytes[..pos]) };
|
||||
let ta = rkyv::deserialize::<OwnedTrustAnchor, rkyv::rancor::Error>(ata).ok();
|
||||
log::info!("get trust anchor {}", key);
|
||||
log::trace!("get trust anchor'{}' = '{:?}'", key, &ta);
|
||||
|
|
|
|||
Loading…
Reference in a new issue