/*
- * Copyright (C) 2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2011-2012 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
gret = gcry_cipher_encrypt(scc->send->handle, tmp, size,
(unsigned char *)buf, size);
assert(gret == 0);
- ret = write_all(scc->fd, (char *)tmp, &size);
+ ret = xwrite(scc->fd, (char *)tmp, size);
free(tmp);
return ret;
}
assert(gret == 0);
return ret;
}
+
+void sc_crypt(struct stream_cipher *sc, struct iovec *src, struct iovec *dst)
+{
+ gcry_cipher_hd_t handle = sc->handle;
+ gcry_error_t gret;
+
+ /* perform in-place encryption */
+ *dst = *src;
+ gret = gcry_cipher_encrypt(handle, src->iov_base, src->iov_len,
+ NULL, 0);
+ assert(gret == 0);
+}