Root cert buffer too short

This commit is contained in:
ivmarkov 2023-04-26 19:17:19 +00:00
parent 9964466138
commit 2fc4e6ddcf
4 changed files with 21 additions and 6 deletions

View file

@ -29,7 +29,7 @@ use num_derive::FromPrimitive;
pub use self::asn1_writer::ASN1Writer;
use self::printer::CertPrinter;
pub const MAX_CERT_TLV_LEN: usize = 300; // TODO
pub const MAX_CERT_TLV_LEN: usize = 1024; // TODO
// As per https://datatracker.ietf.org/doc/html/rfc5280

View file

@ -368,10 +368,16 @@ impl<'a, 'b, 'c> CmdDataEncoder<'a, 'b, 'c> {
match handler.invoke(transaction, &cmd, &data, encoder) {
Ok(()) => cmd.success(&tracker),
Err(error) => cmd.status(error.into()),
Err(error) => {
error!("Error invoking command: {}", error);
cmd.status(error.into())
}
}
}
Err(status) => Some(status),
Err(status) => {
error!("Error invoking command: {:?}", status);
Some(status)
}
};
if let Some(status) = status {

View file

@ -470,6 +470,8 @@ impl<'a> InvReq<'a> {
}
pub fn complete(self, tx: &mut Packet, _transaction: &mut Transaction) -> Result<bool, Error> {
let suppress = self.suppress_response.unwrap_or_default();
let mut tw = TLVWriter::new(tx.get_writebuf()?);
if self.inv_requests.is_some() {
@ -478,7 +480,12 @@ impl<'a> InvReq<'a> {
tw.end_container()?;
Ok(true)
Ok(if suppress {
error!("Supress response is set, is this the expected handling?");
false
} else {
true
})
}
}

View file

@ -25,6 +25,7 @@ use crate::error::Error;
use crate::interaction_model::core::{ResumeReadReq, ResumeSubscribeReq};
use crate::secure_channel;
use crate::secure_channel::case::CaseSession;
use crate::tlv::print_tlv_list;
use crate::utils::epoch::Epoch;
use crate::utils::rand::Rand;
@ -204,13 +205,14 @@ impl Exchange {
return Ok(false);
}
trace!("payload: {:x?}", tx.as_mut_slice());
trace!("payload: {:x?}", tx.as_slice());
info!(
"{} with proto id: {} opcode: {}",
"{} with proto id: {} opcode: {}, tlv:\n",
"Sending".blue(),
tx.get_proto_id(),
tx.get_proto_opcode(),
);
print_tlv_list(tx.as_slice());
tx.proto.exch_id = self.id;
if self.role == Role::Initiator {