diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2022-02-15 13:47:28 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2022-03-28 14:08:09 +0200 |
commit | b41958f99f24022f0f71e67bb57ab4def74267ca (patch) | |
tree | 4fe3fe4b964310d3852620b8e83ed3bf95e36b19 /openpgp/src/parse | |
parent | f66d98e0fac7320af3e918bbb69f09b130df3d63 (diff) |
openpgp: Explicit SEIP packet version in the message parser.
- In order to deal with version 2 SEIP packets, we first need to be
explicit about the packet version in the message parser.
- Rename the token and grammar rules, pass in a version to
MessageParser::push.
Diffstat (limited to 'openpgp/src/parse')
-rw-r--r-- | openpgp/src/parse/packet_parser_builder.rs | 3 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/openpgp/src/parse/packet_parser_builder.rs b/openpgp/src/parse/packet_parser_builder.rs index 24b9a13b..e23767a0 100644 --- a/openpgp/src/parse/packet_parser_builder.rs +++ b/openpgp/src/parse/packet_parser_builder.rs @@ -444,7 +444,8 @@ impl<'a> PacketParserBuilder<'a> { match PacketParser::parse(Box::new(self.bio), state, vec![ 0 ])? { ParserResult::Success(mut pp) => { // We successfully parsed the first packet's header. - pp.state.message_validator.push(pp.packet.tag(), &[0]); + pp.state.message_validator.push( + pp.packet.tag(), pp.packet.version(), &[0]); pp.state.keyring_validator.push(pp.packet.tag()); pp.state.cert_validator.push(pp.packet.tag()); Ok(PacketParserResult::Some(pp)) diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 992b6f3c..4d2694ae 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -709,7 +709,7 @@ enum IMessageLayer { depth: isize, /// Do we expect an MDC packet? /// - /// I.e. is this a SEIP container? + /// I.e. is this a SEIPv1 container? expect_mdc: bool, sym_algo: SymmetricAlgorithm, aead_algo: Option<AEADAlgorithm>, @@ -2414,7 +2414,8 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { v.structure.new_encryption_layer( pp.recursion_depth(), - pp.packet.tag() == packet::Tag::SEIP, + pp.packet.tag() == packet::Tag::SEIP + && pp.packet.version() == Some(1), sym_algo, if let Packet::AED(ref p) = pp.packet { Some(p.aead()) |