summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse/stream.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-12-11 14:41:17 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-12-11 14:46:30 +0100
commit35119b755db270ab43a8e1ec13577bc0f9846546 (patch)
tree2499fe86c242b8aa7e05df02f56640e11e8e920b /openpgp/src/parse/stream.rs
parent582a079f1cccc07bd74432ceb55da09e698da2d0 (diff)
openpgp: Pass the hash algo's security reqs to Policy::signature.
- If the signer controls the data that is being signed, then the hash algorithm only needs second pre-image resistance. - This observation can be used to extend the life of hash algorithms that have been weakened, as is the case for SHA-1. - Introduces a new `enum HashAlgoSecurity`, which is now passed to `Policy::signature`. - See #595.
Diffstat (limited to 'openpgp/src/parse/stream.rs')
-rw-r--r--openpgp/src/parse/stream.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs
index f799a4ce..e9d26205 100644
--- a/openpgp/src/parse/stream.rs
+++ b/openpgp/src/parse/stream.rs
@@ -2719,7 +2719,10 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> {
} else {
match sig.verify(ka.key()) {
Ok(()) => {
- if let Err(error) = self.policy.signature(&sig) {
+ if let Err(error)
+ = self.policy.signature(
+ &sig, Default::default())
+ {
t!("{:02X}{:02X}: signature rejected by policy: {}",
sigid[0], sigid[1], error);
VerificationErrorInternal::BadSignature {