fix tab/space

This commit is contained in:
occheung 2020-10-21 18:18:54 +08:00
parent 5986777770
commit eadf776da3
8 changed files with 1689 additions and 1686 deletions

View File

@ -12,6 +12,7 @@ num_enum = { version = "0.5.1", default-features = false }
log = "0.4.11" log = "0.4.11"
generic-array = "0.14.4" generic-array = "0.14.4"
heapless = "0.5.6" heapless = "0.5.6"
asn1_der = { version = "0.7.1", features = [ "native_types", "no_std" ] }
[dependencies.aes-gcm] [dependencies.aes-gcm]
version = "0.8.0" version = "0.8.0"

View File

@ -9,12 +9,15 @@ pub mod parse;
pub mod buffer; pub mod buffer;
pub mod key; pub mod key;
pub mod session; pub mod session;
pub mod certificate;
use nom::error::ParseError;
// TODO: Implement errors // TODO: Implement errors
// Details: Encapsulate smoltcp & nom errors // Details: Encapsulate smoltcp & nom errors
pub enum Error { pub enum Error {
PropagatedError(smoltcp::Error), PropagatedError(smoltcp::Error),
ParsingError, ParsingError(nom::error::ErrorKind),
EncryptionError, EncryptionError,
DecryptionError, DecryptionError,
CapacityError, CapacityError,

View File

@ -22,11 +22,10 @@ use hkdf::Hkdf;
use smoltcp_tls::key::*; use smoltcp_tls::key::*;
use smoltcp_tls::buffer::TlsBuffer; use smoltcp_tls::buffer::TlsBuffer;
use asn1_der::{ use smoltcp_tls::certificate::*;
DerObject,
typed::{ DerEncodable, DerDecodable }
};
use asn1_der::DerObject;
use smoltcp_tls::parse::*;
struct CountingRng(u64); struct CountingRng(u64);
@ -78,14 +77,14 @@ fn main() {
).unwrap(); ).unwrap();
// tls_socket.tls_connect(&mut sockets).unwrap(); // tls_socket.tls_connect(&mut sockets).unwrap();
let object = DerObject::decode(&CERT).expect("Failed to decode object"); let (rest, result) = parse_asn1_der_certificate(&CERT).unwrap();
println!("raw: {:2X?},\nheader: {:2X?},\ntag: {:2X?},\nvalue: {:2X?}\n", println!(
object.raw(), "{:X?}\n{:X?}\n{:X?}\n{:X?}",
object.header(), rest,
object.tag(), result.0,
object.value() result.1,
result.2
); );
} }
const CERT: [u8; 805] = [ const CERT: [u8; 805] = [