From beb9cf38b3fccef8e4318769760ce43e4b4c400b Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Mon, 28 Nov 2016 15:20:01 +0200 Subject: [PATCH] lib-dcrypt: Add error handling for dcrypt_key_id_private --- src/lib-dcrypt/istream-decrypt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib-dcrypt/istream-decrypt.c b/src/lib-dcrypt/istream-decrypt.c index 9da17e8a68..a8aea314db 100644 --- a/src/lib-dcrypt/istream-decrypt.c +++ b/src/lib-dcrypt/istream-decrypt.c @@ -291,7 +291,13 @@ ssize_t i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg, u return -1; } buffer_create_from_data(&buf, dgst, sizeof(dgst)); - dcrypt_key_id_private(stream->priv_key, "sha256", &buf, NULL); + if (!dcrypt_key_id_private(stream->priv_key, "sha256", &buf, + &error)) { + io_stream_set_error(&stream->istream.iostream, "Decryption error: " + "dcrypt_key_id_private failed: %s", + error); + return -1; + } } /* for each key */ -- 2.47.3