diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-12-17 18:02:46 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-12-17 18:06:00 +0100 |
commit | 6f520703f56624ed11288e3004e180699a48cfd4 (patch) | |
tree | 84e857b53a411ff71c69ddd9385a53429b5d1cfc /openpgp/examples | |
parent | ddd960f80c2d88bfcfedc6a0f0b2a3cf0cd783f5 (diff) |
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.
Diffstat (limited to 'openpgp/examples')
-rw-r--r-- | openpgp/examples/statistics.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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<String> = 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; |