+/* --- @mpcrypt@ --- *
+ *
+ * Arguments: @mp *d@ = the destination integer
+ * @mp *x@ = the plaintext/ciphertext integer
+ * @size_t sz@ = the expected size of the plaintext
+ * @const octet *k@ = pointer to key material
+ * @size_t ksz@ = size of the key
+ *
+ * Returns: The encrypted/decrypted integer.
+ *
+ * Use: Encrypts (or decrypts) a multiprecision integer using another
+ * multiprecision integer as the key. This is a slightly grotty
+ * way to do this, but it's easier than the alternatives.
+ */
+
+static mp *mpcrypt(mp *d, mp *x, size_t sz, const octet *k, size_t ksz)
+{
+ MGF_CTX m;
+
+ MGF_INIT(&m, k, ksz, 0);
+ mp_storeb(x, buf_t, sz);
+ MGF_CRYPT(&m, buf_t, buf_t, sz);
+ return (mp_loadb(d, buf_t, sz));
+}
+