From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ICm7D6Aju14ccwAA0tVLHw (envelope-from ) for ; Tue, 12 May 2020 22:30:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 6IuCLK4ju16TcwAAbx9fmQ (envelope-from ) for ; Tue, 12 May 2020 22:31:10 +0000 Received: from arlo.cworth.org (unknown [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 51475940C73 for ; Tue, 12 May 2020 22:31:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D40D96DE14BA; Tue, 12 May 2020 15:30:24 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LUH9AXKpUQNN; Tue, 12 May 2020 15:30:24 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 617116DE142D; Tue, 12 May 2020 15:30:06 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id A11876DE13E3 for ; Tue, 12 May 2020 15:30:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TZfdBfVO8Ok7 for ; Tue, 12 May 2020 15:30:00 -0700 (PDT) Received: from che.mayfirst.org (unknown [162.247.75.117]) by arlo.cworth.org (Postfix) with ESMTPS id 3D5856DE13D2 for ; Tue, 12 May 2020 15:29:56 -0700 (PDT) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019; t=1589322594; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=rTYMZfPULHoVgrilWdaf7uUI7Aq3pI7YY7trp3pF2b4=; b=uovqKEZeGacjHgKO1UGiEmS9uvodLrmj7Xb+BCKtlm8Gs1Dfa8evO4AhQReE4HprepQ0l LUCQkx4s/TCTsXxAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019rsa; t=1589322594; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=rTYMZfPULHoVgrilWdaf7uUI7Aq3pI7YY7trp3pF2b4=; b=bB/Tyw36/oeO6Bbn6ik5awtfnNIRfbc/N6eOaTrMYWWDZV+nWYAsztrtvOLtC9JjU5pOc /5llr3RnkYDzJA3xu0S/KDggCpZz8StjB1IDEv/YWncEKiuqv9fTj6AXlvK+VlCHKaazUpk NUztvZ0+EXisE3qwq1s1xd58Z6aFVeg4rbYKoJP68GGopMWRB9SfrIp6WsSbfCgHlx/tH2m +zRqqcolfWf19umFEBoIrqFcPBcFUgQ6iF8MEQpofaKYvbTUaUhpRjChYyTKg2KDfWLOuMj wA2q5ZpCn8sgOu0giPmON+5CKCKoKf0S+BLPKxgmuH4oXjpbt5JJ2GhkiU4g== Received: from fifthhorseman.net (unknown [IPv6:2001:470:1f07:60d:f2de:f1ff:fec3:d109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by che.mayfirst.org (Postfix) with ESMTPSA id BF9A7F9A8 for ; Tue, 12 May 2020 18:29:54 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id EC10920C9A; Tue, 12 May 2020 18:29:51 -0400 (EDT) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2 6/9] crypto: Make _notmuch_crypto_decrypt take a GMimeObject Date: Tue, 12 May 2020 18:29:36 -0400 Message-Id: <20200512222939.372093-7-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512222939.372093-1-dkg@fifthhorseman.net> References: <20200512222939.372093-1-dkg@fifthhorseman.net> MIME-Version: 1.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 4.59 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=fifthhorseman.net header.s=2019 header.b=uovqKEZe; dkim=fail (body hash did not verify) header.d=fifthhorseman.net header.s=2019rsa header.b=bB/Tyw36; dmarc=fail reason="SPF not aligned (relaxed)" header.from=fifthhorseman.net (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [4.59 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RDNS_NONE(1.00)[]; GENERIC_REPUTATION(0.00)[-0.44776928976262]; FORGED_SENDER_MAILLIST(0.00)[]; DWL_DNSWL_BLOCKED(0.00)[50.126.95.6:from]; R_SPF_ALLOW(-0.20)[+a:c]; R_DKIM_REJECT(1.00)[fifthhorseman.net:s=2019,fifthhorseman.net:s=2019rsa]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.18), country: US(-0.00), ip: 50.126.95.6(-0.45)]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[fifthhorseman.net:-]; MX_GOOD(-0.50)[cached: notmuchmail.org]; MAILLIST(-0.20)[mailman]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; FROM_NEQ_ENVFROM(0.00)[dkg@fifthhorseman.net,notmuch-bounces@notmuchmail.org]; RDNS_DNSFAIL(0.00)[]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[fifthhorseman.net:email,notmuchmail.org:email]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; DNSWL_BLOCKED(0.00)[50.126.95.6:from]; MID_CONTAINS_FROM(1.00)[]; HFILTER_HOSTNAME_UNKNOWN(2.50)[]; RCVD_COUNT_SEVEN(0.00)[8]; DMARC_POLICY_SOFTFAIL(0.10)[fifthhorseman.net : SPF not aligned (relaxed),none] X-TUID: 0xvIzgqbgVIe As we prepare to handle S/MIME-encrypted PKCS#7 EnvelopedData (which is not multipart), we don't want to be limited to passing only GMimeMultipartEncrypted MIME parts to _notmuch_crypto_decrypt. There is no functional change here, just a matter of adjusting how we pass arguments internally. Signed-off-by: Daniel Kahn Gillmor --- lib/index.cc | 8 ++++---- mime-node.c | 3 +-- util/crypto.c | 6 +++--- util/crypto.h | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index f029b334..da9a3abe 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -369,7 +369,7 @@ _index_content_type (notmuch_message_t *message, GMimeObject *part) static void _index_encrypted_mime_part (notmuch_message_t *message, notmuch_indexopts_t *indexopts, - GMimeMultipartEncrypted *part, + GMimeObject *part, _notmuch_message_crypto_t *msg_crypto); static void @@ -439,7 +439,7 @@ _index_mime_part (notmuch_message_t *message, g_mime_multipart_get_part (multipart, i)); if (i == GMIME_MULTIPART_ENCRYPTED_CONTENT) { _index_encrypted_mime_part (message, indexopts, - GMIME_MULTIPART_ENCRYPTED (part), + part, msg_crypto); } else { if (i != GMIME_MULTIPART_ENCRYPTED_VERSION) { @@ -551,7 +551,7 @@ _index_mime_part (notmuch_message_t *message, static void _index_encrypted_mime_part (notmuch_message_t *message, notmuch_indexopts_t *indexopts, - GMimeMultipartEncrypted *encrypted_data, + GMimeObject *encrypted_data, _notmuch_message_crypto_t *msg_crypto) { notmuch_status_t status; @@ -603,7 +603,7 @@ _index_encrypted_mime_part (notmuch_message_t *message, g_object_unref (decrypt_result); } GMimeObject *toindex = clear; - if (_notmuch_message_crypto_potential_payload (msg_crypto, clear, GMIME_OBJECT (encrypted_data), GMIME_MULTIPART_ENCRYPTED_CONTENT) && + if (_notmuch_message_crypto_potential_payload (msg_crypto, clear, encrypted_data, GMIME_MULTIPART_ENCRYPTED_CONTENT) && msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) { toindex = _notmuch_repair_crypto_payload_skip_legacy_display (clear); if (toindex != clear) diff --git a/mime-node.c b/mime-node.c index b6431e3b..c2ee858d 100644 --- a/mime-node.c +++ b/mime-node.c @@ -253,7 +253,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part) GError *err = NULL; GMimeDecryptResult *decrypt_result = NULL; notmuch_status_t status; - GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part); notmuch_message_t *message = NULL; if (! node->unwrapped_child) { @@ -266,7 +265,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part) node->unwrapped_child = _notmuch_crypto_decrypt (&node->decrypt_attempted, node->ctx->crypto->decrypt, message, - encrypteddata, &decrypt_result, &err); + part, &decrypt_result, &err); if (node->unwrapped_child) set_unwrapped_child_destructor (node); } diff --git a/util/crypto.c b/util/crypto.c index 0bb6f526..fbd5f011 100644 --- a/util/crypto.c +++ b/util/crypto.c @@ -34,7 +34,7 @@ GMimeObject * _notmuch_crypto_decrypt (bool *attempted, notmuch_decryption_policy_t decrypt, notmuch_message_t *message, - GMimeMultipartEncrypted *part, + GMimeObject *part, GMimeDecryptResult **decrypt_result, GError **err) { @@ -55,7 +55,7 @@ _notmuch_crypto_decrypt (bool *attempted, } if (attempted) *attempted = true; - ret = g_mime_multipart_encrypted_decrypt (part, + ret = g_mime_multipart_encrypted_decrypt (GMIME_MULTIPART_ENCRYPTED (part), GMIME_DECRYPT_NONE, notmuch_message_properties_value (list), decrypt_result, err); @@ -81,7 +81,7 @@ _notmuch_crypto_decrypt (bool *attempted, GMimeDecryptFlags flags = GMIME_DECRYPT_NONE; if (decrypt == NOTMUCH_DECRYPT_TRUE && decrypt_result) flags |= GMIME_DECRYPT_EXPORT_SESSION_KEY; - ret = g_mime_multipart_encrypted_decrypt (part, flags, NULL, + ret = g_mime_multipart_encrypted_decrypt (GMIME_MULTIPART_ENCRYPTED (part), flags, NULL, decrypt_result, err); return ret; } diff --git a/util/crypto.h b/util/crypto.h index f8bda0d1..4fa5599c 100644 --- a/util/crypto.h +++ b/util/crypto.h @@ -18,7 +18,7 @@ GMimeObject * _notmuch_crypto_decrypt (bool *attempted, notmuch_decryption_policy_t decrypt, notmuch_message_t *message, - GMimeMultipartEncrypted *part, + GMimeObject *part, GMimeDecryptResult **decrypt_result, GError **err); -- 2.26.2