From e6490b8d71a26a96714b070667f93656f3afb489 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 15 May 2018 09:58:40 +0200 Subject: Make sure we don't return plaintext if decryption failed As a measure against EFAIL. --- framework/src/domain/mime/crypto.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/src/domain/mime/crypto.cpp b/framework/src/domain/mime/crypto.cpp index 9722dba8..1b121931 100644 --- a/framework/src/domain/mime/crypto.cpp +++ b/framework/src/domain/mime/crypto.cpp @@ -211,6 +211,10 @@ std::pair Crypto::decryptAndVerify(CryptoPr auto err = gpgme_op_decrypt_verify(ctx, Data{ciphertext}.data, out); if (err) { qWarning() << "Failed to decrypt and verify" << Error{err}; + //We make sure we don't return any plain-text if the decryption failed to prevent EFAIL + if (err == GPG_ERR_DECRYPT_FAILED) { + return std::make_pair(DecryptionResult{{}, {err}}, VerificationResult{{}, {err}}); + } } VerificationResult verificationResult{{}, {err}}; -- cgit v1.2.3