summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-09-03 10:25:35 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-09-03 10:25:35 +0200
commit7cb2412c528a4fc9d15413695888ddf4bb4c7c3c (patch)
treece6d40e548ea3bf2ee1ba730c214cfda2ff9cf1b
parentcf0c186e5b2b77865560e0ff68cd96f60b7edfc9 (diff)
openpgp: Sort the self-sigs before sorting the bindings.
- The ordering of bindings may use information stored in the current self-sig, which the code assumes is the last signature.
-rw-r--r--openpgp/src/tpk/mod.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs
index c250cb48..93be265e 100644
--- a/openpgp/src/tpk/mod.rs
+++ b/openpgp/src/tpk/mod.rs
@@ -775,14 +775,14 @@ impl<C> ComponentBindings<C>
}
});
- // Now, resort the bindings. When sorting by bindings, we also
- // consider the information on the current self signature.
- self.sort_unstable();
-
// And sort the certificates.
for b in self.bindings.iter_mut() {
b.sort_and_dedup();
}
+
+ // Now, resort the bindings. When sorting by bindings, we also
+ // consider the information on the current self signature.
+ self.sort_unstable();
}
}
@@ -1477,16 +1477,6 @@ impl TPK {
self.bad.sort_by(sig_cmp);
self.bad.dedup();
- for binding in &mut self.userids.iter_mut() {
- binding.sort_and_dedup();
- }
- for binding in &mut self.user_attributes.iter_mut() {
- binding.sort_and_dedup();
- }
- for binding in &mut self.subkeys.iter_mut() {
- binding.sort_and_dedup();
- }
-
self.userids.sort_and_dedup(UserID::cmp, |_, _| {});
self.user_attributes.sort_and_dedup(UserAttribute::cmp, |_, _| {});
// XXX: If we have two keys with the same public parts and