- logger(LOG_DEBUG, _("Received encrypted %d bytes"), inlen);
- evbuffer_expand(c->buffer->input, inlen);
- result = EVP_DecryptUpdate(c->inctx, (unsigned char *)c->buffer->input->buffer, &outlen, (unsigned char *)bufp, inlen);
- if(!result || outlen != inlen) {
- logger(LOG_ERR, _("Error while decrypting metadata from %s (%s): %s"),
- c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
+ size_t outlen = inlen;
+ ifdebug(META) logger(LOG_DEBUG, _("Received encrypted %d bytes"), inlen);
+ evbuffer_expand(c->buffer->input, c->buffer->input->off + inlen);
+
+ if(!cipher_decrypt(&c->incipher, bufp, inlen, c->buffer->input->buffer + c->buffer->input->off, &outlen, false) || inlen != outlen) {
+ logger(LOG_ERR, _("Error while decrypting metadata from %s (%s)"),
+ c->name, c->hostname);