+ * \sa \ref write_all(), RC4(3).
+ */
+int rc4_send_bin_buffer(struct rc4_context *rc4c, const char *buf, size_t len)
+{
+ int ret;
+ unsigned char *tmp;
+
+ assert(len);
+ tmp = para_malloc(len);
+ RC4(&rc4c->send_key, len, (const unsigned char *)buf, tmp);
+ ret = write_all(rc4c->fd, (char *)tmp, &len);
+ free(tmp);
+ return ret;
+}
+
+/**
+ * Encrypt and send a \p NULL-terminated buffer.
+ *
+ * \param rc4c The rc4 crypt context.
+ * \param buf The buffer to send.
+ *
+ * \return The return value of the underyling call to rc4_send_bin_buffer().
+ */
+int rc4_send_buffer(struct rc4_context *rc4c, const char *buf)
+{
+ return rc4_send_bin_buffer(rc4c, buf, strlen(buf));
+}
+
+/**
+ * Format, encrypt and send a buffer.
+ *
+ * \param rc4c The rc4 crypt context.
+ * \param fmt A format string.
+ *
+ * \return The return value of the underyling call to rc4_send_buffer().
+ */
+__printf_2_3 int rc4_send_va_buffer(struct rc4_context *rc4c, const char *fmt, ...)
+{
+ char *msg;
+ int ret;
+
+ PARA_VSPRINTF(fmt, msg);
+ ret = rc4_send_buffer(rc4c, msg);
+ free(msg);
+ return ret;
+}
+
+/**
+ * Receive a buffer and decrypt it.
+ *
+ * \param rc4c The rc4 crypt context.
+ * \param buf The buffer to write the decrypted data to.
+ * \param size The size of \a buf.