summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2023-07-06 19:30:40 +0200
committerJustus Winter <justus@sequoia-pgp.org>2023-07-06 19:33:07 +0200
commit00a2fc56ed639ae0210e44f53ba4fe474fdb79c0 (patch)
treeddd3b2e2c389a2b5dd19119206143fdccf94ac52
parentc5670ce4958a33c4a7c3b861bdb1619f4b02e217 (diff)
openpgp: Do not try to add subpackets to v3 signatures.
- When we verify signatures, we sometimes add information to the signature's unhashed subpacket area. This doesn't work for v3 signatures, as those don't have subpackets.
-rw-r--r--openpgp/src/packet/signature.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/openpgp/src/packet/signature.rs b/openpgp/src/packet/signature.rs
index 4862f6a3..39d8ce96 100644
--- a/openpgp/src/packet/signature.rs
+++ b/openpgp/src/packet/signature.rs
@@ -2454,6 +2454,11 @@ impl crate::packet::Signature {
return Ok(());
}
+ if self.version() == 3 {
+ return Err(Error::InvalidOperation(
+ "cannot add information to v3 signature".into()).into());
+ }
+
/// Makes an authenticated subpacket.
fn authenticated_subpacket(v: SubpacketValue) -> Result<Subpacket> {
let mut p = Subpacket::new(v, false)?;