use proper Result instead of Option for encryption and decryption

This commit is contained in:
dignifiedquire
2019-09-18 17:07:28 +02:00
committed by holger krekel
parent cee0e22ce7
commit 8667de994e
4 changed files with 82 additions and 70 deletions

View File

@@ -296,7 +296,7 @@ impl E2eeHelper {
if (*plain).str_0.is_null() || (*plain).len <= 0 {
ok_to_continue = false;
} else {
if let Some(ctext_v) = dc_pgp_pk_encrypt(
if let Ok(ctext_v) = dc_pgp_pk_encrypt(
std::slice::from_raw_parts(
(*plain).str_0 as *const u8,
(*plain).len,
@@ -908,7 +908,7 @@ unsafe fn decrypt_part(
};
/*if we already have fingerprints, do not add more; this ensures, only the fingerprints from the outer-most part are collected */
if let Some(plain) = dc_pgp_pk_decrypt(
if let Ok(plain) = dc_pgp_pk_decrypt(
std::slice::from_raw_parts(decoded_data as *const u8, decoded_data_bytes),
&private_keyring,
&public_keyring_for_validate,