|
|
f43be0 |
# HG changeset patch
|
|
|
f43be0 |
# User Kai Engert <kaie@kuix.de>
|
|
|
f43be0 |
# Date 1664378971 0
|
|
|
f43be0 |
# Wed Sep 28 15:29:31 2022 +0000
|
|
|
f43be0 |
# Node ID 98bde42cf14e966da1cdf098e2d0917032c0f327
|
|
|
f43be0 |
# Parent af0b1f5e4c7710f824c6141103e516ca60bc78aa
|
|
|
f43be0 |
Bug 1791195 - Adjust OpenPGP signature handling for RNP >= 0.16.2. r=mkmelin
|
|
|
f43be0 |
|
|
|
f43be0 |
Differential Revision: https://phabricator.services.mozilla.com/D158270
|
|
|
f43be0 |
|
|
|
f43be0 |
diff --git a/comm/mail/extensions/openpgp/content/modules/RNP.jsm b/comm/mail/extensions/openpgp/content/modules/RNP.jsm
|
|
|
f43be0 |
--- a/comm/mail/extensions/openpgp/content/modules/RNP.jsm
|
|
|
f43be0 |
+++ b/comm/mail/extensions/openpgp/content/modules/RNP.jsm
|
|
|
f43be0 |
@@ -1150,22 +1150,25 @@ var RNP = {
|
|
|
f43be0 |
|
|
|
f43be0 |
result.exitCode = RNPLib.rnp_op_verify_execute(verify_op);
|
|
|
f43be0 |
|
|
|
f43be0 |
let rnpCannotDecrypt = false;
|
|
|
f43be0 |
let queryAllEncryptionRecipients = false;
|
|
|
f43be0 |
+ let stillUndecidedIfSignatureIsBad = false;
|
|
|
f43be0 |
|
|
|
f43be0 |
let useDecodedData;
|
|
|
f43be0 |
let processSignature;
|
|
|
f43be0 |
switch (result.exitCode) {
|
|
|
f43be0 |
case RNPLib.RNP_SUCCESS:
|
|
|
f43be0 |
useDecodedData = true;
|
|
|
f43be0 |
processSignature = true;
|
|
|
f43be0 |
break;
|
|
|
f43be0 |
case RNPLib.RNP_ERROR_SIGNATURE_INVALID:
|
|
|
f43be0 |
- result.statusFlags |= EnigmailConstants.BAD_SIGNATURE;
|
|
|
f43be0 |
+ // Either the signing key is unavailable, or the signature is
|
|
|
f43be0 |
+ // indeed bad. Must check signature status below.
|
|
|
f43be0 |
+ stillUndecidedIfSignatureIsBad = true;
|
|
|
f43be0 |
useDecodedData = true;
|
|
|
f43be0 |
- processSignature = false;
|
|
|
f43be0 |
+ processSignature = true;
|
|
|
f43be0 |
break;
|
|
|
f43be0 |
case RNPLib.RNP_ERROR_SIGNATURE_EXPIRED:
|
|
|
f43be0 |
useDecodedData = true;
|
|
|
f43be0 |
processSignature = false;
|
|
|
f43be0 |
result.statusFlags |= EnigmailConstants.EXPIRED_SIGNATURE;
|
|
|
f43be0 |
@@ -1320,13 +1323,30 @@ var RNP = {
|
|
|
f43be0 |
options.fromAddr,
|
|
|
f43be0 |
options.msgDate,
|
|
|
f43be0 |
verify_op,
|
|
|
f43be0 |
result
|
|
|
f43be0 |
);
|
|
|
f43be0 |
+
|
|
|
f43be0 |
+ if (
|
|
|
f43be0 |
+ (result.statusFlags &
|
|
|
f43be0 |
+ (EnigmailConstants.GOOD_SIGNATURE |
|
|
|
f43be0 |
+ EnigmailConstants.UNCERTAIN_SIGNATURE |
|
|
|
f43be0 |
+ EnigmailConstants.EXPIRED_SIGNATURE |
|
|
|
f43be0 |
+ EnigmailConstants.BAD_SIGNATURE)) !=
|
|
|
f43be0 |
+ 0
|
|
|
f43be0 |
+ ) {
|
|
|
f43be0 |
+ // A decision was already made.
|
|
|
f43be0 |
+ stillUndecidedIfSignatureIsBad = false;
|
|
|
f43be0 |
+ }
|
|
|
f43be0 |
}
|
|
|
f43be0 |
}
|
|
|
f43be0 |
|
|
|
f43be0 |
+ if (stillUndecidedIfSignatureIsBad) {
|
|
|
f43be0 |
+ // We didn't find more details above, so conclude it's bad.
|
|
|
f43be0 |
+ result.statusFlags |= EnigmailConstants.BAD_SIGNATURE;
|
|
|
f43be0 |
+ }
|
|
|
f43be0 |
+
|
|
|
f43be0 |
RNPLib.rnp_input_destroy(input_from_memory);
|
|
|
f43be0 |
RNPLib.rnp_output_destroy(output_to_memory);
|
|
|
f43be0 |
RNPLib.rnp_op_verify_destroy(verify_op);
|
|
|
f43be0 |
|
|
|
f43be0 |
if (
|
|
|
f43be0 |
@@ -1458,10 +1478,12 @@ var RNP = {
|
|
|
f43be0 |
let have_signer_key = false;
|
|
|
f43be0 |
let use_signer_key = false;
|
|
|
f43be0 |
|
|
|
f43be0 |
if (query_signer) {
|
|
|
f43be0 |
if (RNPLib.rnp_op_verify_signature_get_key(sig, signer_key.address())) {
|
|
|
f43be0 |
+ // If sig_status isn't RNP_ERROR_KEY_NOT_FOUND then we must
|
|
|
f43be0 |
+ // be able to obtain the signer key.
|
|
|
f43be0 |
throw new Error("rnp_op_verify_signature_get_key");
|
|
|
f43be0 |
}
|
|
|
f43be0 |
|
|
|
f43be0 |
have_signer_key = true;
|
|
|
f43be0 |
use_signer_key = !this.isBadKey(signer_key);
|