mirror of
https://github.com/chatmail/core.git
synced 2026-05-15 12:56:30 +03:00
transfer docs to and cleanup some parts of e2ee::decrypt()
This commit is contained in:
12
src/e2ee.rs
12
src/e2ee.rs
@@ -380,7 +380,6 @@ impl E2eeHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn decrypt(&mut self, context: &Context, in_out_message: *mut mailmime) {
|
pub unsafe fn decrypt(&mut self, context: &Context, in_out_message: *mut mailmime) {
|
||||||
let mut iterations: libc::c_int;
|
|
||||||
/* return values: 0=nothing to decrypt/cannot decrypt, 1=sth. decrypted
|
/* return values: 0=nothing to decrypt/cannot decrypt, 1=sth. decrypted
|
||||||
(to detect parts that could not be decrypted, simply look for left "multipart/encrypted" MIME types */
|
(to detect parts that could not be decrypted, simply look for left "multipart/encrypted" MIME types */
|
||||||
/*just a pointer into mailmime structure, must not be freed*/
|
/*just a pointer into mailmime structure, must not be freed*/
|
||||||
@@ -455,8 +454,7 @@ impl E2eeHelper {
|
|||||||
public_keyring_for_validate.add_ref(key);
|
public_keyring_for_validate.add_ref(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iterations = 0i32;
|
for iterations in 0..10 {
|
||||||
while iterations < 10i32 {
|
|
||||||
let mut has_unencrypted_parts: libc::c_int = 0i32;
|
let mut has_unencrypted_parts: libc::c_int = 0i32;
|
||||||
if decrypt_recursive(
|
if decrypt_recursive(
|
||||||
context,
|
context,
|
||||||
@@ -471,11 +469,15 @@ impl E2eeHelper {
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if iterations == 0i32 && 0 == has_unencrypted_parts {
|
/* if we're here, sth. was encrypted. if we're on top-level,
|
||||||
|
and there are no additional unencrypted parts in the message
|
||||||
|
the encryption was fine (signature is handled separately and
|
||||||
|
returned as `signatures`) */
|
||||||
|
if iterations == 0 && 0 == has_unencrypted_parts {
|
||||||
self.encrypted = true;
|
self.encrypted = true;
|
||||||
}
|
}
|
||||||
iterations += 1;
|
|
||||||
}
|
}
|
||||||
|
/* check for Autocrypt-Gossip */
|
||||||
if !gossip_headers.is_null() {
|
if !gossip_headers.is_null() {
|
||||||
self.gossipped_addr = update_gossip_peerstates(
|
self.gossipped_addr = update_gossip_peerstates(
|
||||||
context,
|
context,
|
||||||
|
|||||||
Reference in New Issue
Block a user