summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2020-12-07 16:30:52 +0100
committerAzul <azul@riseup.net>2020-12-08 10:36:50 +0100
commit52794155913ce1fa78ce01a41b29c67e721e9847 (patch)
tree1d1d5776f8aca2594031916fe9179aa90e41ed8c
parent88df27d0ae174b87e980371c5600d470516ed116 (diff)
openpgp: Require Policies to be Send and Sync.
- This ensures that all types with Policies (`Valid*`) are `Send` and `Sync`.
-rw-r--r--openpgp/src/cert.rs2
-rw-r--r--openpgp/src/cert/amalgamation.rs1
-rw-r--r--openpgp/src/cert/amalgamation/iter.rs1
-rw-r--r--openpgp/src/parse/stream.rs2
-rw-r--r--openpgp/src/policy.rs2
5 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/src/cert.rs b/openpgp/src/cert.rs
index 287d1de9..fb6dedba 100644
--- a/openpgp/src/cert.rs
+++ b/openpgp/src/cert.rs
@@ -728,7 +728,6 @@ pub struct Cert {
bad: Vec<packet::Signature>,
}
} // doc-hack, see above
-
assert_send_and_sync!{Cert}
impl std::str::FromStr for Cert {
@@ -2871,6 +2870,7 @@ pub struct ValidCert<'a> {
// The reference time.
time: time::SystemTime,
}
+assert_send_and_sync!{ValidCert<'_>}
impl<'a> std::ops::Deref for ValidCert<'a> {
type Target = Cert;
diff --git a/openpgp/src/cert/amalgamation.rs b/openpgp/src/cert/amalgamation.rs
index 69da539a..2cac62e2 100644
--- a/openpgp/src/cert/amalgamation.rs
+++ b/openpgp/src/cert/amalgamation.rs
@@ -1078,6 +1078,7 @@ pub struct ValidComponentAmalgamation<'a, C> {
// The binding signature at time `time`. (This is just a cache.)
binding_signature: &'a Signature,
}
+assert_send_and_sync!{ValidComponentAmalgamation<'_, C>, C}
/// A Valid User ID and its associated data.
///
diff --git a/openpgp/src/cert/amalgamation/iter.rs b/openpgp/src/cert/amalgamation/iter.rs
index 9e01911c..8c864537 100644
--- a/openpgp/src/cert/amalgamation/iter.rs
+++ b/openpgp/src/cert/amalgamation/iter.rs
@@ -246,6 +246,7 @@ pub struct ValidComponentAmalgamationIter<'a, C> {
// at time `t`.
revoked: Option<bool>,
}
+assert_send_and_sync!{ValidComponentAmalgamationIter<'_, C>, C}
/// An iterator over `ValidUserIDAmalgamtion`s.
///
diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs
index 1a2dd940..e8bd8d42 100644
--- a/openpgp/src/parse/stream.rs
+++ b/openpgp/src/parse/stream.rs
@@ -231,6 +231,7 @@ pub struct GoodChecksum<'a> {
/// trustworthiness of the signature using a trust model.
pub ka: ValidErasedKeyAmalgamation<'a, key::PublicParts>,
}
+assert_send_and_sync!{GoodChecksum<'_>}
/// A bad signature.
///
@@ -454,6 +455,7 @@ impl<'a> VerificationErrorInternal<'a> {
/// [test of unusual message structures]: https://tests.sequoia-pgp.org/#Unusual_Message_Structure
#[derive(Debug)]
pub struct MessageStructure<'a>(Vec<MessageLayer<'a>>);
+assert_send_and_sync!{MessageStructure<'_>}
impl<'a> MessageStructure<'a> {
fn new() -> Self {
diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs
index fc74fe59..4920317b 100644
--- a/openpgp/src/policy.rs
+++ b/openpgp/src/policy.rs
@@ -62,7 +62,7 @@ use cutofflist::{
};
/// A policy for cryptographic operations.
-pub trait Policy : fmt::Debug {
+pub trait Policy : fmt::Debug + Send + Sync {
/// Returns an error if the signature violates the policy.
///
/// This function performs the last check before the library