From 6f520703f56624ed11288e3004e180699a48cfd4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 17 Dec 2019 18:02:46 +0100 Subject: openpgp: Make Subpacket own the data. - The subpacket areas now have a vector of subpackets. Change some accessors here and there to accommodate this. - This requires bit-perfect roundtripping of subpackets so that signatures are not invalidated. - First step towards fixing #200. --- openpgp/examples/statistics.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openpgp/examples') diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs index 7f4f00c2..0b453467 100644 --- a/openpgp/examples/statistics.rs +++ b/openpgp/examples/statistics.rs @@ -15,6 +15,7 @@ use crate::openpgp::types::*; use crate::openpgp::packet::{user_attribute, header::BodyLength, Tag}; use crate::openpgp::packet::signature::subpacket::SubpacketTag; use crate::openpgp::parse::{Parse, PacketParserResult, PacketParser}; +use crate::openpgp::serialize::SerializeInto; fn main() { let args: Vec = env::args().collect(); @@ -140,7 +141,7 @@ fn main() { cert.sigs[u8::from(sig.typ()) as usize] += 1; let mut signature = PerSignature::min(); - for (_offset, len, sub) in sig.hashed_area().iter() + for sub in sig.hashed_area().iter() .chain(sig.unhashed_area().iter()) { use crate::openpgp::packet::signature::subpacket::*; @@ -152,6 +153,7 @@ fn main() { sigs_subpacket_tags_unknown [u8::from(sub.tag()) as usize] += 1; } else { + let len = sub.serialized_len(); sigs_subpacket_tags_size_bytes[i] += len; sigs_subpacket_tags_size_count[i] += 1; let len = len as u32; -- cgit v1.2.3