io_stream_set_error(&stream->istream.iostream, "Private key not available");
return -1;
}
+ dcrypt_key_ref_private(stream->priv_key);
} else {
io_stream_set_error(&stream->istream.iostream, "Private key not available");
return -1;
return -1;
}
if (ret > 0) {
+ dcrypt_key_ref_private(stream->priv_key);
have_key = TRUE;
break;
}
dcrypt_ctx_sym_destroy(&(dstream->ctx_sym));
if (dstream->ctx_mac != NULL)
dcrypt_ctx_hmac_destroy(&(dstream->ctx_mac));
+ if (dstream->priv_key != NULL)
+ dcrypt_key_unref_private(&(dstream->priv_key));
i_stream_unref(&(dstream->istream.parent));
}
struct decrypt_istream *dstream;
dstream = i_stream_create_decrypt_common(input);
+ dcrypt_key_ref_private(priv_key);
dstream->priv_key = priv_key;
return &dstream->istream.istream;
}
if (estream->key_data != NULL) i_free(estream->key_data);
if (estream->cipher_oid != NULL) buffer_free(&(estream->cipher_oid));
if (estream->mac_oid != NULL) buffer_free(&(estream->mac_oid));
-
+ if (estream->pub != NULL) dcrypt_key_unref_public(&(estream->pub));
o_stream_unref(&estream->ostream.parent);
}
struct encrypt_ostream *estream = o_stream_create_encrypt_common(flags);
int ec;
+ dcrypt_key_ref_public(box_pub);
estream->pub = box_pub;
T_BEGIN {